Click here to Skip to main content
15,845,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Utterly lost about ETW. [modified] Pin
David Crow9-Nov-09 7:23
David Crow9-Nov-09 7:23 
AnswerRe: Utterly lost about ETW. Pin
i_kant_spel9-Nov-09 17:08
i_kant_spel9-Nov-09 17:08 
Questionpopup menus Pin
doug258-Nov-09 4:23
doug258-Nov-09 4:23 
AnswerRe: popup menus Pin
Richard MacCutchan8-Nov-09 7:24
mveRichard MacCutchan8-Nov-09 7:24 
AnswerRe: popup menus Pin
Chris Losinger8-Nov-09 17:21
professionalChris Losinger8-Nov-09 17:21 
GeneralRe: popup menus Pin
doug2510-Nov-09 0:06
doug2510-Nov-09 0:06 
GeneralRe: popup menus Pin
doug2510-Nov-09 1:00
doug2510-Nov-09 1:00 
GeneralRe: popup menus Pin
doug2510-Nov-09 2:02
doug2510-Nov-09 2:02 
i fixed the problem Smile | :)

because my program is a dll
i actually create an invisible window so i have a window procedure for the popup menu, when the popup menu gets destroyed it calls DestroyWindow to destroy the invisible window.

for some reason when i use a message loop after TrackPopupMenuEx the loop catches the WM_DESTROY message, quits the loop and after that MessageBox works.

it fixes the problem (MessageBox didn't show) but i don't quite understand why ?

here's a snippet of code

item_selected = TrackPopupMenuEx(menu, flags, x, y, hInvisibleWindow, NULL);<br />
<br />
    // Start the message loop. <br />
<br />
	int result = 0;<br />
<br />
	MSG msg;<br />
 <br />
    while( (result = GetMessage( &msg, NULL, 0, 0 )) != 0)<br />
    { <br />
        if (result == -1)<br />
        {<br />
            // handle the error and possibly exit<br />
        }<br />
        else<br />
        {<br />
            TranslateMessage(&msg); <br />
            DispatchMessage(&msg); <br />
        }<br />
    }<br />
<br />
MessageBox(NULL, "Got to the end of showPopupMenu !", "Success!", MB_ICONEXCLAMATION | MB_OK);


code from the WndProc

case WM_UNINITMENUPOPUP:<br />
    DestroyWindow(hInvisibleWindow);<br />
break;<br />
    case WM_DESTROY:<br />
        PostQuitMessage(0);<br />
    break;<br />
    default:<br />
        return DefWindowProc(hwnd, msg, wParam, lParam);

QuestionA very hard question? friend function again! Pin
wanchao5078-Nov-09 3:48
wanchao5078-Nov-09 3:48 
AnswerRe: A very hard question? friend function again! Pin
CPallini8-Nov-09 6:13
mveCPallini8-Nov-09 6:13 
AnswerRe: A very hard question? friend function again! Pin
N a v a n e e t h8-Nov-09 7:07
N a v a n e e t h8-Nov-09 7:07 
GeneralRe: A very hard question? friend function again! Pin
wanchao5078-Nov-09 17:29
wanchao5078-Nov-09 17:29 
GeneralRe: A very hard question? friend function again! Pin
N a v a n e e t h8-Nov-09 20:37
N a v a n e e t h8-Nov-09 20:37 
AnswerRe: A very hard question? friend function again! Pin
wanchao5078-Nov-09 17:10
wanchao5078-Nov-09 17:10 
QuestionStatic variable Pin
kumar sanghvi8-Nov-09 2:39
kumar sanghvi8-Nov-09 2:39 
AnswerRe: Static variable Pin
Richard MacCutchan8-Nov-09 3:13
mveRichard MacCutchan8-Nov-09 3:13 
QuestionWeird situation with WinSock Pin
hxhl957-Nov-09 20:19
hxhl957-Nov-09 20:19 
AnswerRe: Weird situation with WinSock Pin
Code-o-mat8-Nov-09 1:01
Code-o-mat8-Nov-09 1:01 
GeneralRe: Weird situation with WinSock Pin
hxhl958-Nov-09 7:41
hxhl958-Nov-09 7:41 
AnswerRe: Weird situation with WinSock Pin
David Crow9-Nov-09 4:20
David Crow9-Nov-09 4:20 
Questionwin32 prog Pin
himmi20097-Nov-09 17:40
himmi20097-Nov-09 17:40 
GeneralRe: win32 prog Pin
himmi20097-Nov-09 17:41
himmi20097-Nov-09 17:41 
AnswerRe: win32 prog Pin
«_Superman_»7-Nov-09 19:38
professional«_Superman_»7-Nov-09 19:38 
AnswerRe: win32 prog Pin
himmi20098-Nov-09 5:17
himmi20098-Nov-09 5:17 
GeneralRe: win32 prog Pin
«_Superman_»8-Nov-09 7:13
professional«_Superman_»8-Nov-09 7:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.