I have a problem with this Window Procedure. in new versions of Windows OS, when I run the program, at first everything is painted & then paintings disappear (until the window receives the next paint message)
long _stdcall WndProc
(
HWND hwnd,
unsigned msg,
unsigned wParam,
long lParam
)
{
if(!peb1)
return DefWindowProc(hwnd,msg,wParam,lParam);
switch(msg)
{
case WM_CREATE:
{
return 0;
}
case WM_ACTIVATE:
case WM_SIZING:
{
DefWindowProc(hwnd,msg,wParam,lParam);
// Paint();
return 0;
}
case WM_ERASEBKGND:
{
DefWindowProc(hwnd,msg,(unsigned)v_hdc,lParam);
//return 0;
}
case WM_PAINT:
{
peb1 -> V_Paint();
peb2 -> V_Paint();
peb3 -> V_Paint();
pbtn1 -> V_Paint();
pbtn2 -> V_Paint();
pbtn3 -> Paint();
return DefWindowProc(hwnd,msg,wParam,lParam);
}
case WM_SYSCOMMAND:
{
DefWindowProc(hwnd,msg,wParam,lParam);
switch(wParam)
{
/*case SC_MAXIMIZE:
case SC_RESTORE:
Paint(); */
}
return 0;
}
case WM_MOUSEWHEEL:
{
peb1 -> wmMousewheel(wParam,lParam);
peb2 -> wmMousewheel(wParam,lParam);
return 0;
}
case WM_MOUSEMOVE:
{
TrackLeave(hwnd);
peb1 -> wmMousemove(lParam);
peb2 -> wmMousemove(lParam);
return 0;
}
case WM_MOUSELEAVE:
{
//MessageBeep(-1);
return 0;
}
case WM_MOUSEHOVER:
{
return 0;
}
case WM_LBUTTONDOWN:
{
peb1 -> wmLbuttondown(lParam);
peb2 -> wmLbuttondown(lParam);
pbtn1 -> wmLbuttondown(lParam);
pbtn2 -> wmLbuttondown(lParam);
pbtn3 -> wmLbuttondown(lParam);
return 0;
}
case WM_LBUTTONUP:
{
peb1 -> wmLbuttonup(lParam);
peb2 -> wmLbuttonup(lParam);
pbtn1 -> wmLbuttonup(lParam);
pbtn2 -> wmLbuttonup(lParam);
pbtn3 -> wmLbuttonup(lParam);
return 0;
}
case WM_RBUTTONDOWN:
{
return 0;
}
case WM_CLOSE:
{
DestroyWindow(hwnd);
return 0;
}
case WM_DESTROY:
{
delete peb1;
delete peb2;
PostQuitMessage(0);
return 0;
}
case WM_CHAR:
{
peb1 -> wmChar(wParam);
peb2 -> wmChar(wParam);
return 0;
}
case WM_TIMER:
{
return 0;
}
case WM_KEYDOWN:
{
peb1 -> wmKeydown(wParam);
peb2 -> wmKeydown(wParam);
return 0;
}
case WM_SYSKEYDOWN:
{
peb1 -> wmSyskeydown(wParam);
peb2 -> wmSyskeydown(wParam);
return 0;
}
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
}
there's also a problem with mouse click messages. I think they are not caught properly by window procedure.
there's no problem in Windows XP. These problems are in Vista & Seven.
I can attach all the project if necessary!