GetMessage from hidden window

  • Thread starter Thread starter Rajko
  • Start date Start date
R

Rajko

Strange, very strange.

I'm using CDialog to process messages form CMenu.
CDialog does not enter modal state.
CDialog constructor have Create() and
CDialog destructor have CWnd::DestroyWindow();

I'm using following code to dispatch message to CDialog:
MSG msg;
GetMessage(&msg);
DispatchMessage(&msg);

Now, if CDialog is visible code runs ok.

If CDialog is NOT visible code stops at GetMessage() and hungs ???
Why? What to do? I dont want CDialog to be visible.

I could try somehting like this:
dlgPM.ShowWindow(SW_SHOW);
GetMessage(&msg, dlgPM.m_hWnd, 0, 0);
dlgPM.ShowWindow(SW_HIDE);
but it blinks on screen and I dont want that either.

Thanks for help, Rajko.
 
Ah, what a stupid.
I was little tired .... and irritated because Windows Shell did not allow me
to insert more that 16 menu items so I needed to rewrite some good code
which is supposed to work anyway.

Of course ShowWindow sent message, and PeekMessage is better solution.

Rajko.
 
Back
Top