Release 981025.
[wine/gsoc-2012-control.git] / rc / systest.c
blob3939e1df4c2ef6a76c10534da6793e98d67b520c
1 #include <windows.h>
3 LRESULT CALLBACK _export WndProc(HWND hWnd, UINT message,
4 WPARAM wParam, LPARAM lParam);
6 BOOL CALLBACK _export DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
8 HINSTANCE hInst;
9 HMENU hMenu,dummy;
10 extern char sysres_MENU_SYSMENU[],sysres_BITMAP_WINELOGO[],sysres_DIALOG_2[];
12 int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
13 LPSTR lpszCmdLine, int cmdShow)
15 MSG msg;
16 WNDCLASS wcHdumpClass;
17 HWND hWndMain;
19 hInst=hInstance;
21 // Define the window class for this application.
22 wcHdumpClass.lpszClassName = "WrcTestClass";
23 wcHdumpClass.hInstance = hInstance;
24 wcHdumpClass.lpfnWndProc = WndProc;
25 wcHdumpClass.hCursor = 0;
26 wcHdumpClass.hIcon = 0;
27 wcHdumpClass.lpszMenuName = 0;
28 wcHdumpClass.hbrBackground = GetStockObject(WHITE_BRUSH);
29 wcHdumpClass.style = CS_HREDRAW | CS_VREDRAW;
30 wcHdumpClass.cbClsExtra = 0;
31 wcHdumpClass.cbWndExtra = 0;
32 RegisterClass(&wcHdumpClass);
34 hWndMain = CreateWindow("WrcTestClass","WrcTest",
35 WS_OVERLAPPEDWINDOW,
36 CW_USEDEFAULT, // x window location
37 CW_USEDEFAULT, // y
38 CW_USEDEFAULT, // cx and size
39 CW_USEDEFAULT, // cy
40 NULL, // no parent for this window
41 NULL, // use the class menu
42 hInstance, // who created this window
43 NULL // no parms to pass on
45 ShowWindow(hWndMain,SW_SHOW);
46 UpdateWindow(hWndMain);
47 hMenu=LoadMenuIndirect(sysres_MENU_SYSMENU);
49 /* see Q75254 on how to create a popup menu via LoadMenuIndirect */
50 dummy=CreateMenu();
51 InsertMenu(dummy,0,MF_POPUP,hMenu,NULL);
52 hMenu=GetSubMenu(dummy,0);
54 while (GetMessage(&msg, NULL, NULL, NULL))
56 TranslateMessage(&msg);
57 DispatchMessage(&msg);
60 return(msg.wParam);
63 LRESULT CALLBACK _export WndProc(HWND hWnd, UINT message,
64 WPARAM wParam, LPARAM lParam)
66 POINT ptCurrent;
67 switch(message)
69 case WM_LBUTTONDOWN:
70 ptCurrent=MAKEPOINT(lParam);
71 ClientToScreen(hWnd,&ptCurrent);
72 TrackPopupMenu(hMenu,0,ptCurrent.x,ptCurrent.y,0,hWnd,0);
73 break;
74 case WM_PAINT:
75 { PAINTSTRUCT ps;
76 BITMAPINFO *bm=sysres_BITMAP_WINELOGO;
77 char *bits=bm;
78 bits+=bm->bmiHeader.biSize;
79 bits+=(1<<bm->bmiHeader.biBitCount)*sizeof(RGBQUAD);
80 BeginPaint(hWnd,&ps);
81 SetDIBitsToDevice(ps.hdc,0,0,bm->bmiHeader.biWidth,
82 bm->bmiHeader.biHeight,0,0,0,bm->bmiHeader.biHeight,
83 bits,bm,DIB_RGB_COLORS);
84 EndPaint(hWnd,&ps);
85 break;
87 case WM_COMMAND:
88 CreateDialogIndirect(hInst,sysres_DIALOG_2,hWnd,DlgProc);
89 break;
90 case WM_DESTROY:
91 PostQuitMessage(0);
92 break;
93 default:return DefWindowProc(hWnd,message,wParam,lParam);
95 return 0L;
98 BOOL CALLBACK _export DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
100 switch(msg)
102 case WM_INITDIALOG:
103 return 1;
104 case WM_COMMAND:
105 DestroyWindow(hWnd);
106 return 0;
108 return 0;