I'm having a problem with this program. When I run it, I can interact with the buttons and text-edit-window, but I cannot interact with the "outer" controls, ie X-button, minimize button, resize window, move window etc...
It's probably a simple obvious error, but I can't find it...
Code:
//*** Included Files ***
#include <windows.h>
#include "TextEdit.h"
//*** Message Handler ***
LRESULT MessageHandler(HWND WinHandle, UINT Message, WPARAM wParam, LPARAM lParam)
{
//Do stuff
switch(Message)
{
//Interaction with buttons
case WM_COMMAND:
switch(LOWORD(wParam))
{
//Press the button EXIT
case SystemExit:
DestroyWindow(WinHandle);
break;
}
break;
//Window shutdown has been activated (X or EXIT)
case WM_CLOSE:
DestroyWindow(WinHandle);
break;
//Window has been destroyed (See above)
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
//In case message didn't get handled, do default handling
return DefWindowProc(WinHandle, Message, wParam, lParam);
}
//Return success
return 0;
}
//*** Creates A Window ***
void SetupWindow(HINSTANCE CurInst)
{
//Creates a handle window
HWND HandleWindow;
//Create the window object (modeless)
HandleWindow=CreateDialog(CurInst, MAKEINTRESOURCE(MainForm), NULL, (DLGPROC)MessageHandler);
//Make the window appear
ShowWindow(HandleWindow, SW_SHOW);
}
//*** Win Main ***
int WINAPI WinMain(HINSTANCE CurInst, HINSTANCE PrevInst, LPSTR ParList, int WinShowType)
{
//Data
MSG Message;
BOOL ProgramStatus=TRUE;
//Creates a window
SetupWindow(CurInst);
//Main loop
while(ProgramStatus==TRUE)
{
if(PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
{
//Message processing
if(Message.message==WM_QUIT) ProgramStatus=FALSE;
TranslateMessage(&Message);
DispatchMessage(&Message);
}
else
{
//Idle
}
}
//Exit
return 0;
}