Release 951212
[wine/multimedia.git] / toolkit / hello.c
blob4285ac132b609b932c502c303c6d128c31895ff4
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;
46 if (!prev){
47 class.style = CS_HREDRAW | CS_VREDRAW;
48 class.lpfnWndProc = WndProc;
49 class.cbClsExtra = 0;
50 class.cbWndExtra = 0;
51 class.hInstance = inst;
52 class.hIcon = LoadIcon (0, IDI_APPLICATION);
53 class.hCursor = LoadCursor (0, IDC_ARROW);
54 class.hbrBackground = GetStockObject (WHITE_BRUSH);
55 class.lpszMenuName = NULL;
56 class.lpszClassName = (SEGPTR)"class";
58 if (!RegisterClass (&class))
59 return FALSE;
61 wnd = CreateWindow ("class", "Test app", WS_OVERLAPPEDWINDOW,
62 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
63 0, inst, 0);
64 ShowWindow (wnd, show);
65 UpdateWindow (wnd);
67 while (GetMessage (&msg, 0, 0, 0)){
68 TranslateMessage (&msg);
69 DispatchMessage (&msg);
71 return 0;