I believe there is a typo in your code as posted. If I run that code as my window proc, everything works properly because the last thing that is always performed is
DefWindowProc.
I believe the problem you are seeing is caused by not processing the
DefWindowProc in the
WM_SYSCOMMAND case.
Change the code posted above to the following and it should do what you are asking for. I have placed a
default handler in both of your switch statements to make sure
DefWindowProc is called appropriately:
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = 0;
switch (message)
{
case WM_SYSCOMMAND:
switch(wParam)
{
case SC_MINIMIZE:
ShowWindow(hwnd, SW_HIDE); break;
default:
lResult = DefWindowProc (hwnd, message, wParam, lParam);
}
break;
case WM_DESTROY:
PostQuitMessage (0);
return (0);
default:
lResult = DefWindowProc (hwnd, message, wParam, lParam);
}
return lResult;
}
Something like this would cause the issue you are describing:
switch(wParam)
case WM_SYSCOMMAND:
switch (message)
{
case SC_MINIMIZE:
ShowWindow(hwnd, SW_HIDE); break;
default:
return 0;
}
Regards,
Paul