3 void Write (HDC dc, int x, int y, char *s)
5 TextOut (dc, x, y, s, strlen (s));
8 LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
10 static short xChar, yChar;
18 GetTextMetrics (dc, &tm);
19 xChar = tm.tmAveCharWidth;
25 dc = BeginPaint (wnd, &ps);
26 Write (dc, xChar, yChar, "Hola");
35 return DefWindowProc (wnd, msg, w, l);
40 int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
45 char className[] = "class"; /* To make sure className >= 0x10000 */
46 char winName[] = "Test app";
49 class.style = CS_HREDRAW | CS_VREDRAW;
50 class.lpfnWndProc = WndProc;
53 class.hInstance = inst;
54 class.hIcon = LoadIcon (0, IDI_APPLICATION);
55 class.hCursor = LoadCursor (0, IDC_ARROW);
56 class.hbrBackground = GetStockObject (WHITE_BRUSH);
57 class.lpszMenuName = NULL;
58 class.lpszClassName = (SEGPTR)className;
60 if (!RegisterClass (&class))
63 wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW,
64 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
66 ShowWindow (wnd, show);
69 while (GetMessage (&msg, 0, 0, 0)){
70 TranslateMessage (&msg);
71 DispatchMessage (&msg);