Changed // comments to /* */ so WINE compiles with non-gcc compilers
[wine/multimedia.git] / libtest / hello.c
blob7de4fb5098ed3b527420c10494f36bdd6eb78721
1 #include <windows.h>
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;
11 HDC dc;
12 PAINTSTRUCT ps;
13 TEXTMETRIC tm;
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;
24 case WM_PAINT:
25 dc = BeginPaint (wnd, &ps);
26 Write (dc, xChar, yChar, "Hola");
27 EndPaint (wnd, &ps);
28 break;
30 case WM_DESTROY:
31 PostQuitMessage (0);
32 break;
34 default:
35 return DefWindowProc (wnd, msg, w, l);
37 return 0l;
40 int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
42 HWND wnd;
43 MSG msg;
44 WNDCLASS class;
45 char className[] = "class"; /* To make sure className >= 0x10000 */
46 char winName[] = "Test app";
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;
60 if (!RegisterClass (&class))
61 return FALSE;
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);
69 while (GetMessage (&msg, 0, 0, 0)){
70 TranslateMessage (&msg);
71 DispatchMessage (&msg);
73 return 0;