Du mangler at definere din wnd-class (MainWClass) og der mangler en message-loop.
Det kunne f.ex. se sådan ud:
#include <windows.h>
HINSTANCE hInstance;
HWND hwndMain;
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS wc;
memset(&wc, 0, sizeof(WNDCLASS));
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = DefWindowProc;
wc.hInstance = hInstance;
wc.hbrBackground = (HBRUSH )(COLOR_BTNFACE + 1);
wc.lpszClassName = "MainWClass";
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
if(!RegisterClass(&wc))
return FALSE;
hwndMain = CreateWindow("MainWClass",
"Hello World",
WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hwndMain, nCmdShow);
MSG Msg;
while(GetMessage(&Msg, hwndMain, 0, 0xFFFF) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 0;
}
Du kan lukke det med Alt+F4