Ett stycke C#-kod:
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND helloStatic, theButton;
switch (message) /* handle the messages */
{
case WM_CREATE:
static wchar_t *txt_1 = L"Press the button to continue!";
helloStatic = CreateWindowW(L"STATIC", txt_1,
WS_CHILD | WS_VISIBLE | SS_LEFT,
20, 20, 300, 20,
hwnd, NULL, NULL, NULL);
theButton = CreateWindowW(L"BUTTON", L"The Button!",
WS_VISIBLE | WS_CHILD,
340, 20, 80, 30,
hwnd, (HMENU) 1, NULL, NULL);
break;
case WM_COMMAND:
switch(LOWORD(wParam)){
case 1:
DestroyWindow(helloStatic);
}
break;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}