2 * Copyright 1995 Martin von Loewis
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 BOOL FileOpen(HWND hWnd)
33 char filename[80] = "test.c";
34 OPENFILENAME ofn = { sizeof(OPENFILENAME),
35 hWnd, NULL, "C code\0*.c\0", NULL, 0, 0, filename, 80,
36 NULL, 0, NULL, NULL, OFN_CREATEPROMPT |
37 OFN_SHOWHELP, 0, 0, NULL, 0, NULL };
38 return GetOpenFileName(&ofn);
41 LRESULT CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
58 LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
65 DialogBox(Globals.hInstance,
72 HBITMAP hBitmap, hPrevBitmap;
75 hBitmap = LoadBitmapA (Globals.hInstance, "BITDEMO");
77 hMemDC = CreateCompatibleDC (hdc);
78 hPrevBitmap = SelectObject (hMemDC, hBitmap);
79 GetObjectA (hBitmap, sizeof(BITMAP), &bmp);
80 BitBlt (hdc, 0, 0, bmp.bmWidth, bmp.bmHeight,
81 hMemDC, 0, 0, SRCCOPY);
82 SelectObject (hMemDC, hPrevBitmap);
91 return DefWindowProc (wnd, msg, w, l);
98 return DefWindowProc (wnd, msg, w, l);
103 int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
107 char className[] = "class"; /* To make sure className >= 0x10000 */
108 char winName[] = "Test app";
110 Globals.hInstance = inst;
112 class.style = CS_HREDRAW | CS_VREDRAW;
113 class.lpfnWndProc = WndProc;
114 class.cbClsExtra = 0;
115 class.cbWndExtra = 0;
116 class.hInstance = inst;
117 class.hIcon = LoadIcon (0, IDI_APPLICATION);
118 class.hCursor = LoadCursor (0, IDC_ARROW);
119 class.hbrBackground = GetStockObject (WHITE_BRUSH);
120 class.lpszMenuName = 0;
121 class.lpszClassName = className;
123 if (!RegisterClass (&class))
126 Globals.hMainWnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW,
127 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
128 LoadMenu(inst,"MAIN"), inst, 0);
129 ShowWindow (Globals.hMainWnd, show);
130 UpdateWindow (Globals.hMainWnd);
132 while (GetMessage (&msg, 0, 0, 0)){
133 TranslateMessage (&msg);
134 DispatchMessage (&msg);