| | |
PeekMessage and PostQuitMessage
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
Im kind confuse about how PostQuitMessage works..
Im using like this:
That is on my WndProc function.
My message loop is like that:
The problem is that it just returns 0 (zero) if I use while( PeekMessage() ) instead of 'If', or if I call PeekMessage again at //***
So, i guess theres some overheads on PostQuitMessage before it send your exit code given on its param..what are those overheads?
And where can I search for exit codes info? I was trying to find it at MSDN but I didnt..
Im using like this:
C++ Syntax (Toggle Plain Text)
case WM_CLOSE : DestroyWindow( hWnd ); break; //send WM_DESTROY case WM_DESTROY : CleanUp(); gsp_quit = true; PostQuitMessage( 0 ); //send WM_QUIT break;
My message loop is like that:
C++ Syntax (Toggle Plain Text)
while ( !gsp_quit ){ if( PeekMessage( &gsp_msg, NULL, NULL, NULL, PM_REMOVE ) ){ TranslateMessage( &gsp_msg ); DispatchMessage ( &gsp_msg ); }//while F PeekMessage() }//F while !gsp_quit //*** return gsp_msg.wParam;//it should return 0
The problem is that it just returns 0 (zero) if I use while( PeekMessage() ) instead of 'If', or if I call PeekMessage again at //***
So, i guess theres some overheads on PostQuitMessage before it send your exit code given on its param..what are those overheads?
And where can I search for exit codes info? I was trying to find it at MSDN but I didnt..
Do you know the difference between GetMessage and PickMessage function?
Here is a text for you.
You can use the PeekMessage function to examine a message queue during a lengthy operation. PeekMessage is similar to the GetMessage function; both check a message queue for a message that matches the filter criteria and then copy the message to an MSG structure. The main difference between the two functions is that GetMessage does not return until a message matching the filter criteria is placed in the queue, whereas PeekMessage returns immediately regardless of whether a message is in the queue.
Here is a text for you.
You can use the PeekMessage function to examine a message queue during a lengthy operation. PeekMessage is similar to the GetMessage function; both check a message queue for a message that matches the filter criteria and then copy the message to an MSG structure. The main difference between the two functions is that GetMessage does not return until a message matching the filter criteria is placed in the queue, whereas PeekMessage returns immediately regardless of whether a message is in the queue.
Failure is not fatal, but failure to change might be. - John Wooden
![]() |
Similar Threads
- does anyone know what this means (C++)
- Restoring a DirectX Fullscreen Window (C++)
- OpenGL (Game Development)
- Open Gl Programing Error (help)... (Game Development)
- Help figuring out (C++)
- graphic.h (Game Development)
- Need help with DirectX code (C)
Other Threads in the C++ Forum
- Previous Thread: Using .h's in muti-source projects
- Next Thread: Using multiple sounds at the same time.
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop developer directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






