13 BOOL FileOpen(HWND hWnd)
15 char filename[80] = "test.c";
16 OPENFILENAME ofn = { sizeof(OPENFILENAME),
17 hWnd, NULL, "C code\0*.c\0", NULL, 0, 0, filename, 80,
18 NULL, 0, NULL, NULL, OFN_CREATEPROMPT |
19 OFN_SHOWHELP, 0, 0, NULL, 0, NULL };
20 return GetOpenFileName(&ofn);
23 LRESULT CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
40 LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
47 DialogBox(Globals.hInstance,
54 HBITMAP hBitmap, hPrevBitmap;
57 hBitmap = LoadBitmapA (Globals.hInstance, "BITDEMO");
59 hMemDC = CreateCompatibleDC (hdc);
60 hPrevBitmap = SelectObject (hMemDC, hBitmap);
61 GetObjectA (hBitmap, sizeof(BITMAP), &bmp);
62 BitBlt (hdc, 0, 0, bmp.bmWidth, bmp.bmHeight,
63 hMemDC, 0, 0, SRCCOPY);
64 SelectObject (hMemDC, hPrevBitmap);
73 return DefWindowProc (wnd, msg, w, l);
80 return DefWindowProc (wnd, msg, w, l);
85 int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
89 char className[] = "class"; /* To make sure className >= 0x10000 */
90 char winName[] = "Test app";
92 Globals.hInstance = inst;
94 class.style = CS_HREDRAW | CS_VREDRAW;
95 class.lpfnWndProc = WndProc;
98 class.hInstance = inst;
99 class.hIcon = LoadIcon (0, IDI_APPLICATION);
100 class.hCursor = LoadCursor (0, IDC_ARROW);
101 class.hbrBackground = GetStockObject (WHITE_BRUSH);
102 class.lpszMenuName = 0;
103 class.lpszClassName = className;
105 if (!RegisterClass (&class))
108 Globals.hMainWnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW,
109 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
110 LoadMenu(inst,"MAIN"), inst, 0);
111 ShowWindow (Globals.hMainWnd, show);
112 UpdateWindow (Globals.hMainWnd);
114 while (GetMessage (&msg, 0, 0, 0)){
115 TranslateMessage (&msg);
116 DispatchMessage (&msg);