Release 951105
[wine/multimedia.git] / toolkit / hello3.c
blobc688cecf277e3e0520975e453ce44986926e21db
1 #include <windows.h>
2 #include "hello3res.h"
4 BOOL CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
6 switch(msg)
8 case WM_INITDIALOG:
9 return 1;
10 case WM_COMMAND:
11 if(wParam==100)
12 DestroyWindow(hWnd);
13 return 0;
15 return 0;
18 LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
20 switch (msg){
22 case WM_COMMAND:
23 switch(w){
24 case 100:
25 CreateDialogIndirect(0,hello3_DIALOG_DIADEMO.bytes,wnd,(WNDPROC)DlgProc);
26 return 0;
27 case 101:
29 BITMAPINFO *bm=hello3_BITMAP_BITDEMO.bytes;
30 char *bits=bm;
31 HDC hdc=GetDC(wnd);
32 bits+=bm->bmiHeader.biSize;
33 bits+=(1<<bm->bmiHeader.biBitCount)*sizeof(RGBQUAD);
34 SetDIBitsToDevice(hdc,0,0,bm->bmiHeader.biWidth,
35 bm->bmiHeader.biHeight,0,0,0,bm->bmiHeader.biHeight,
36 bits,bm,DIB_RGB_COLORS);
37 ReleaseDC(wnd,hdc);
38 return 0;
40 default:
41 return DefWindowProc (wnd, msg, w, l);
43 case WM_DESTROY:
44 PostQuitMessage (0);
45 break;
47 default:
48 return DefWindowProc (wnd, msg, w, l);
50 return 0l;
53 int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
55 HWND wnd;
56 MSG msg;
57 WNDCLASS class;
59 if (!prev){
60 class.style = CS_HREDRAW | CS_VREDRAW;
61 class.lpfnWndProc = WndProc;
62 class.cbClsExtra = 0;
63 class.cbWndExtra = 0;
64 class.hInstance = inst;
65 class.hIcon = LoadIcon (0, IDI_APPLICATION);
66 class.hCursor = LoadCursor (0, IDC_ARROW);
67 class.hbrBackground = GetStockObject (WHITE_BRUSH);
68 class.lpszMenuName = 0;
69 class.lpszClassName = (SEGPTR)"class";
71 if (!RegisterClass (&class))
72 return FALSE;
74 wnd = CreateWindow ("class", "Test app", WS_OVERLAPPEDWINDOW,
75 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
76 LoadMenuIndirect(hello3_MENU_MAIN.bytes), inst, 0);
77 ShowWindow (wnd, show);
78 UpdateWindow (wnd);
80 while (GetMessage (&msg, 0, 0, 0)){
81 TranslateMessage (&msg);
82 DispatchMessage (&msg);
84 return 0;