|
<br />
VOID APIENTRY DisplayContextMenu(HWND hwnd, POINT pt) <br />
{ <br />
HMENU hmenu;
HMENU hmenuTrackPopup;
<br />
<br />
if ((hmenu = LoadMenu(hinst, "ShortcutExample")) == NULL) <br />
return; <br />
<br />
<br />
hmenuTrackPopup = GetSubMenu(hmenu, 0); <br />
<br />
<br />
TrackPopupMenu(hmenuTrackPopup, <br />
TPM_LEFTALIGN | TPM_RIGHTBUTTON, <br />
pt.x, pt.y, 0, hwnd, NULL); <br />
<br />
<br />
DestroyMenu(hmenu); <br />
} <br />
|
|
|
|
|
its done do't west ur time.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
for show menu I suggestion you can use event WM_CONTEXT_MENU
void CAnswerView::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
menu.LoadMenu(IDR_MAINFRAME);
CMenu *m_ContexMenu=menu.GetSubMenu(0);
m_ContextMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,point.x,point.y,AfxGetMainWnd());
}
|
|
|
|
|
hello!
I asked this question some days ago, but got no answer.
I'm stil searching for a good profiler for VS2005 Pro.
Can sombody recommend one?
|
|
|
|
|
I don't think there is a free one available, and it doesn't look like Compuware is releasing a free one for VS2005 like they did for 2003.
For a recent project, I ended up using a demo version of AQTime. A little bit quirky to use at first, but it works good once you know how to use it. Only works for 15 days.
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
Hi !
In my application, I'm making a call to a function provided by a third party library. Unfortunately, this call is crashing in some situations (which I have no way to detect prior to calling the function).
I tried to put the call into a try{} catch{} block, but it didn't work. Here is what I did :
try {
api_call(mydata);
}
catch (...)
{
// error
}
the problem is that my app keeps crashing in the 'try' block, which is something I don't understand. I'm compiling with expection support.
Any hint ?
Thanks !
Jerome
|
|
|
|
|
<br />
__try <br />
{<br />
api_call(mydata);<br />
}<br />
__except ( expression )<br />
{<br />
}<br />
|
|
|
|
|
Hi !
Thanks for your answer, but it seems __try and __except are MS specific keyword. I'm compiling in a linux environnement...
Any onther hint ?
Thanks !
Jerome
|
|
|
|
|
You could give more information, here is my guess.
If you are calling a C-function from a C++-class, you have to do this in the third party .h-file:
Surround all function declarations with this code:
#ifdef __cplusplus
extern "C" {
#endif
// the original function prototypes
#ifdef __cplusplus
}
#endif
Else, the first parameter of all function calls will be the this pointer. And that will make the funcion call to crash...
|
|
|
|
|
Hi thanks for your answer.
I'm actually calling a C++ function from a C++ class. The call to the function works in most cases, but crashes in some specific cases.
Jerome
|
|
|
|
|
Chenxing's solution will work - As much as catching an unexpected exception will ever work. Here's how to do it:
__try
{
api_call(mydata);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
}
Note that catching an unexpected exception is never a good idea - For example the exception might have occurred while a node was being linked into a linked list but has only been half linked in. Or perhaps after a CRITICAL_SECTION was entered but before it is released. Once an unexpected exception occurs the state of the application is suspect.
I realize you may have no choice but nethertheless beware - You may end up creating more problems for yourself.
Steve
I just noticed the comment where you said you're programming on Linux - Sorry.
-- modified at 4:22 Friday 10th March, 2006
|
|
|
|
|
Hi, me again!?
Sorry to be such a pain in the a$$, but was wondering if anyone knows if it is possible to control a powerpoint presentation with a c++ program?
I have been building a remote control application for the computer (eventually, I want to add a USB-serial adapter, so that I can connect a remote receiver to USB...). So far, I can control Winamp, iTunes, WMP and BSPlayer (the only programs I really use for multimedia) and when theyre not running, it will control windows volume. It also has an overriding mute, that will always mute everything.
I was thinking the next/prev track buttons could be used to control a powerpoint presentation, as this could be useful for the future... but its proving difficult to find any information on it...
Does anyone have any ideas?
Thanks,
Mark
|
|
|
|
|
Try this[^]. PowerPoint's fairly easy to control - I've done it a lot.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
wow! thats great! ive looked everywhere... dont know y i couldnt find anything...
but thanks a lot! looks like its gonna take me a while to get my head round, but at least it must be doable! is always nice to know...!!
do you know if this would also control the presentation if being viewed through powerpoint viewer/standalone presentation? im guessing not...
Also, it doesnt mention controlling slides when the slideshow is running... is that similar?
Thanks a lot,
Mark
|
|
|
|
|
markhaslehurst wrote: do you know if this would also control the presentation if being viewed through powerpoint viewer/standalone presentation?
PowerPoint has to be installed for it to work. Your application will start PowerPoint and work from there.
markhaslehurst wrote: Also, it doesnt mention controlling slides when the slideshow is running... is that similar?
You can use the Next() and Previous() methods on the SlideShowView class for that.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
great! that gives me a lot to work with!
Thanks for the help!
Mark
oh, btw... one question... I dont have Visual C++, i use a free command line Borland compiler... so do you know how I can use the MSPPT.OLB file?
Thanks!
|
|
|
|
|
markhaslehurst wrote: I dont have Visual C++, i use a free command line Borland compiler... so do you know how I can use the MSPPT.OLB file?
Oh, just a minor detail
I've never used Borland, so I don't know how it does things. You can download the free Visual C++ Express Edition from here[^]
BTW, the file is just a renamed type library. You can rename it to .tlb if Borland handles them...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
lol.
no.. renaming doesnt work... but i have downloaded the visual c++ installer... it wants to download a lot more though... so i think ill run it tonite, or else the rest of the company wont be able to get on the net!
thanks a lot for all the help mate.
Mark
|
|
|
|
|
markhaslehurst wrote: no.. renaming doesnt work...
Bummer. I could send you the source files that are generated when the Visual C++ compiler imports it, but they are MFC specific, so won't work with Borland or the Visual C++ Express Edition.
I hope the express edition supports .olb files, or you might have a small problem
Anyhow, glad I could help Have fun!
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
na. s'ok. thanks a lot for all help mate.
ill just have to give it a go and see...!
Thanks a lot, its really appreciated.
Mark
|
|
|
|
|
markhaslehurst wrote: I dont have Visual C++, i use a free command line Borland compiler
have you noticed on what forum/site you asked ??
Codeproject is quite dedicated to Microsoft technologies...
|
|
|
|
|
sorry... didnt realise... and to be honest, most sites are geared at MS products... just also seems like the best c++ forum around... and for most things, the compiler is not important.
|
|
|
|
|
markhaslehurst wrote: for most things, the compiler is not important.
hum, if you mean "most" for "standard C++", yeah, if is stands in the standard implementation of the compiler (knowing that nowadays, no compiler implements 100% of the C++ Standard, not even VC++2005).
but if you ask for an OWL question, i think that most people here won't know about it at all...
|
|
|
|
|
well i dunno what OWL is. im only a beginner, but all the advice i have received and all the articles that i have read on this site have worked using my compiler until this library problem, so dont think it really matters for the majority of coding.
|
|
|
|
|
OWL is the graphical library of borland (equivalent of MFC in Visual C++).
actually, if you work in console, yes, using cout/cin (or worse, C function like printf(), etc...) will work because there are part of the standard. standard mean that all C++ compiler provides them, and they work the same way.
if you need to use a specific library (gotoxy() for instance), it won't work on microsoft compiler.
|
|
|
|