1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
void main(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int iCmdShow){
................................
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
// handle or dispatch messages
if ( msg.message == WM_QUIT )
{
quit = TRUE;
}
else if (msg.lParam == WM_USER)
glColor3f(0.0f,0.0f,1.0f);//MessageBox(NULL,"Malaka1","ERROR",MB_OK|MB_ICONSTOP);//refresh(LOWORD(msg.lParam), HIWORD(msg.lParam));
else if (msg.message == WM_SIZE)
MessageBox(NULL,"Malaka2","ERROR",MB_OK|MB_ICONSTOP);
else
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
else
.............
}
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
...........
case WM_SIZE: // Resize The OpenGL Window
{
//MessageBox(NULL,"Malaka","ERROR",MB_OK|MB_ICONSTOP);
//PostMessage(hWnd,WM_SIZE,0,0);
PostMessage(hWnd,WM_USER,0,0);
return 0; // Jump Back
}
|