Re: VC++
Hi Arman,
the code I have written in onpaint member function is as follows:
while (g_isProgramLooping) // Loop Until WM_QUIT Is Received
{
// Create A Window
/* window.init.isFullScreen = g_createFullScreen; // Set Init
Param Of Window Creation To Fullscreen?
if (CreateWindowGL (&window) == TRUE) // Was Window Creation
Successful?
{*/
// At This Point We Should Have A Window That Is Setup To Render
OpenGL
if (Initialize () == FALSE) // Call User Intialization
{
// Failure
// TerminateApplication (&window); // Close Window, This Will
Handle The Shutdown
}
else // Otherwise (Start The Message Pump)
{ // Initialize was a success
isMessagePumpActive = TRUE; // Set isMessagePumpActive To
TRUE
while (isMessagePumpActive == TRUE) // While The Message Pump
Is Active
{
// Success Creating Window. Check For Window Messages
/* if (PeekMessage (&msg, m_hWnd, 0, 0, PM_REMOVE) != 0)
{*/
// Check For WM_QUIT Message
if (msg.message != WM_QUIT) // Is The Message A WM_QUIT
Message?
{
DispatchMessage (&msg); // If Not, Dispatch The Message
}
else// Otherwise (If Message Is WM_QUIT)
{
isMessagePumpActive = FALSE; // Terminate The Message Pump
}
/* }
else // If There Are No Messages
{*/
if (isVisible == FALSE) // If Window Is Not Visible
{
WaitMessage (); // Application Is Minimized Wait For A
Message
}
else // If Window Is Visible
{
// Process Application Loop
tickCount = GetTickCount (); // Get The Tick Count
Update (tickCount - lastTickCount); // Update The Counter
lastTickCount = tickCount; // Set Last Count To Current Count
Draw (); // Draw Our Scene
SwapBuffers (hdc); // Swap Buffers (Double Buffering)
}
//}
} // Loop While isMessagePumpActive == TRUE
} // If (Initialize (...
// Application Is Finished
/* Deinitialize (); // User Defined DeInitialization
DestroyWindowGL (&window);*/ // Destroy The Active Window
//}
// Error Creating Window
// Terminate The Loop
wglMakeCurrent(NULL, NULL) ;
::ReleaseDC (m_hWnd, hdc) ;
wglDeleteContext(hglrc);
}
I want to handle all the messages that can come to a window. How should
I do that. like in w32 we have WindowProc function, do we have
something similar in mfc.