New file to test DRIVE_GetLabel.
[wine] / libtest / hello.c
1 #include <windows.h>
2
3 void Write (HDC dc, int x, int y, char *s)
4 {
5     TextOut (dc, x, y, s, strlen (s));
6 }
7
8 LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
9 {
10     static short xChar, yChar;
11     HDC dc;
12     PAINTSTRUCT ps;
13     TEXTMETRIC tm;
14
15     switch (msg){
16     case WM_CREATE:
17         dc = GetDC (wnd);
18         GetTextMetrics (dc, &tm);
19         xChar = tm.tmAveCharWidth;
20         yChar = tm.tmHeight;
21         ReleaseDC (wnd, dc);
22         break;
23
24     case WM_PAINT:
25         dc = BeginPaint (wnd, &ps);
26         Write (dc, xChar, yChar, "Hola");
27         EndPaint (wnd, &ps);
28         break;
29
30     case WM_DESTROY:
31         PostQuitMessage (0);
32         break;
33
34     default:
35         return DefWindowProc (wnd, msg, w, l);
36     }
37     return 0l;
38 }
39
40 int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
41 {
42     HWND     wnd;
43     MSG      msg;
44     WNDCLASS class;
45     char className[] = "class";  /* To make sure className >= 0x10000 */
46     char winName[] = "Test app";
47
48     if (!prev){
49         class.style = CS_HREDRAW | CS_VREDRAW;
50         class.lpfnWndProc = WndProc;
51         class.cbClsExtra = 0;
52         class.cbWndExtra = 0;
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;
59     }
60     if (!RegisterClass (&class))
61         return FALSE;
62
63     wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW,
64                         CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 
65                         0, inst, 0);
66     ShowWindow (wnd, show);
67     UpdateWindow (wnd);
68
69     while (GetMessage (&msg, 0, 0, 0)){
70         TranslateMessage (&msg);
71         DispatchMessage (&msg);
72     }
73     return 0;
74 }