Release 950522
[wine.git] / toolkit / hello.c
blobd9d9978930aac5bca8f6ddcd8d1e883565c4a20f
1 /* #include "autoconf.h" */
2 #include <windows.h>
4 void Write (HDC dc, int x, int y, char *s)
6 TextOut (dc, x, y, s, strlen (s));
9 LONG WndProc (HANDLE wnd, UINT msg, WORD w, LONG l)
11 static short xChar, yChar;
12 HDC dc;
13 PAINTSTRUCT ps;
14 TEXTMETRIC tm;
16 switch (msg){
17 case WM_CREATE:
18 dc = GetDC (wnd);
19 GetTextMetrics (dc, &tm);
20 xChar = tm.tmAveCharWidth;
21 yChar = tm.tmHeight;
22 ReleaseDC (wnd, dc);
23 break;
25 case WM_PAINT:
26 dc = BeginPaint (wnd, &ps);
27 Write (dc, xChar, yChar, "Hola");
28 EndPaint (wnd, &ps);
29 break;
31 case WM_DESTROY:
32 PostQuitMessage (0);
33 break;
35 default:
36 return DefWindowProc (wnd, msg, w, l);
38 return 0l;
41 int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
43 HWND wnd;
44 MSG msg;
45 WNDCLASS class;
47 if (!prev){
48 class.style = CS_HREDRAW | CS_VREDRAW;
49 class.lpfnWndProc = WndProc;
50 class.cbClsExtra = 0;
51 class.cbWndExtra = 0;
52 class.hInstance = inst;
53 class.hIcon = LoadIcon (0, IDI_APPLICATION);
54 class.hCursor = LoadCursor (0, IDC_ARROW);
55 class.hbrBackground = GetStockObject (WHITE_BRUSH);
56 class.lpszMenuName = NULL;
57 class.lpszClassName = "class";
59 if (!RegisterClass (&class))
60 return FALSE;
62 wnd = CreateWindow ("class", "Test app", WS_OVERLAPPEDWINDOW,
63 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
64 0, inst, 0);
65 ShowWindow (wnd, show);
66 UpdateWindow (wnd);
68 while (GetMessage (&msg, 0, 0, 0)){
69 TranslateMessage (&msg);
70 DispatchMessage (&msg);