Den meget simple version:
#include <windows.h>
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
switch(nMsg)
{
case WM_PAINT:
{
PAINTSTRUCT PaintStruct;
HDC dc = BeginPaint(hwnd, &PaintStruct);
static const char* SomeText = "Jakobs tekst goes here";
TextOut(dc, 10, 10, SomeText, strlen(SomeText));
EndPaint(hwnd, &PaintStruct);
}
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
}
return DefWindowProc(hwnd, nMsg, wParam, lParam);
}
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
WNDCLASSEX wc;
char*szWndClassName = "JacobClassName";
memset (&wc, 0, sizeof(WNDCLASSEX));
wc.lpszClassName = szWndClassName;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MainWndProc;
wc.hInstance = hInst;
wc.hIcon = LoadIcon(NULL, NULL);
wc.hIconSm = LoadIcon(NULL, NULL);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
RegisterClassEx (&wc);
MSG msg;
HWND hwnd;
hwnd = CreateWindow(szWndClassName, "Vindue...", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, hInst, NULL);
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}