| | |
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.
![]() |
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 |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






