1 | /* $Id: wndclass.cpp,v 1.5 1999-06-20 16:47:38 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 Window Class Managment Code for OS/2
|
---|
5 | *
|
---|
6 | * 18-07-1998 SvL: Merged all class code into this file + bug fixes
|
---|
7 | * Register all system classes at dll init
|
---|
8 | * Rewrote incorrect callback code
|
---|
9 | *
|
---|
10 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
11 | *
|
---|
12 | *
|
---|
13 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
14 | *
|
---|
15 | */
|
---|
16 | #include <os2win.h>
|
---|
17 | #include <stdarg.h>
|
---|
18 | #include <assert.h>
|
---|
19 | #include "misc.h"
|
---|
20 | #include "user32.h"
|
---|
21 | #include "wndproc.h"
|
---|
22 | #include "wndclass.h"
|
---|
23 | #include "hooks.h"
|
---|
24 |
|
---|
25 | //default window handlers that are registered by RegisterClass are called
|
---|
26 | //in this callback handler
|
---|
27 | LRESULT EXPENTRY_O32 OS2ToWinCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
28 | //default window handlers that are queried by GetClassInfo/GetClassLong is really
|
---|
29 | //this callback handler
|
---|
30 | LRESULT WIN32API WinToOS2Callback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
31 |
|
---|
32 | #ifdef DEBUG
|
---|
33 | char *GetMsgText(int Msg);
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | DWORD MapOEMToRealKey(DWORD wParam, DWORD lParam);
|
---|
37 |
|
---|
38 | WNDPROC_O32 ButtonHandler = 0;
|
---|
39 | WNDPROC_O32 ListboxHandler = 0;
|
---|
40 | WNDPROC_O32 ComboboxHandler = 0;
|
---|
41 | WNDPROC_O32 EditHandler = 0;
|
---|
42 | WNDPROC_O32 MdiClientHandler = 0;
|
---|
43 | WNDPROC_O32 ScrollbarHandler = 0;
|
---|
44 | WNDPROC_O32 StaticHandler = 0;
|
---|
45 |
|
---|
46 | HWND hwndButton = 0;
|
---|
47 | HWND hwndListbox = 0;
|
---|
48 | HWND hwndEdit = 0;
|
---|
49 | HWND hwndCombobox = 0;
|
---|
50 | HWND hwndScrollbar = 0;
|
---|
51 | HWND hwndMdiClient = 0;
|
---|
52 | HWND hwndStatic = 0;
|
---|
53 |
|
---|
54 | Win32WindowClass *ButtonClass = 0;
|
---|
55 | Win32WindowClass *ListboxClass = 0;
|
---|
56 | Win32WindowClass *EditClass = 0;
|
---|
57 | Win32WindowClass *ComboboxClass = 0;
|
---|
58 | Win32WindowClass *MdiClientClass = 0;
|
---|
59 | Win32WindowClass *ScrollbarClass = 0;
|
---|
60 | Win32WindowClass *StaticClass = 0;
|
---|
61 | //******************************************************************************
|
---|
62 | //******************************************************************************
|
---|
63 | LRESULT WIN32API ButtonCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
64 | {
|
---|
65 | switch(Msg)
|
---|
66 | {
|
---|
67 | case WM_CREATE:
|
---|
68 | case WM_DESTROY:
|
---|
69 | case WM_LBUTTONDOWN:
|
---|
70 | case WM_MBUTTONDOWN:
|
---|
71 | case WM_RBUTTONDOWN:
|
---|
72 | NotifyParent(hwnd, Msg, wParam, lParam);
|
---|
73 | break;
|
---|
74 | }
|
---|
75 | return ButtonHandler(hwnd, Msg, wParam, lParam);
|
---|
76 | }
|
---|
77 | //******************************************************************************
|
---|
78 | //******************************************************************************
|
---|
79 | LRESULT WIN32API ListboxCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
80 | {
|
---|
81 | return ListboxHandler(hwnd, Msg, wParam, lParam);
|
---|
82 | }
|
---|
83 | //******************************************************************************
|
---|
84 | //******************************************************************************
|
---|
85 | LRESULT WIN32API ComboboxCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
86 | {
|
---|
87 | return ComboboxHandler(hwnd, Msg, wParam, lParam);
|
---|
88 | }
|
---|
89 | //******************************************************************************
|
---|
90 | //******************************************************************************
|
---|
91 | LRESULT WIN32API MdiClientCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
92 | {
|
---|
93 | return MdiClientHandler(hwnd, Msg, wParam, lParam);
|
---|
94 | }
|
---|
95 | //******************************************************************************
|
---|
96 | //******************************************************************************
|
---|
97 | LRESULT WIN32API EditCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
98 | {
|
---|
99 | return EditHandler(hwnd, Msg, wParam, lParam);
|
---|
100 | }
|
---|
101 | //******************************************************************************
|
---|
102 | //******************************************************************************
|
---|
103 | LRESULT WIN32API ScrollbarCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
104 | {
|
---|
105 | return ScrollbarHandler(hwnd, Msg, wParam, lParam);
|
---|
106 | }
|
---|
107 | //******************************************************************************
|
---|
108 | //******************************************************************************
|
---|
109 | LRESULT WIN32API StaticCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
110 | {
|
---|
111 | return StaticHandler(hwnd, Msg, wParam, lParam);
|
---|
112 | }
|
---|
113 | //******************************************************************************
|
---|
114 | //SvL: 18-7-'98, Registers system window classes (button, listbox etc etc)
|
---|
115 | //******************************************************************************
|
---|
116 | void RegisterSystemClasses(ULONG hModule)
|
---|
117 | {
|
---|
118 | WNDCLASSA wndclass;
|
---|
119 | HWND hwnd;
|
---|
120 |
|
---|
121 | if(O32_GetClassInfo(NULL, "BUTTON", &wndclass)) {
|
---|
122 | dprintf(("Create BUTTON System class"));
|
---|
123 | ButtonClass = new Win32WindowClass(ButtonCallback, "BUTTON", hModule);
|
---|
124 | ButtonHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
|
---|
125 | hwndButton = O32_CreateWindow("BUTTON", "BUTTON", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
---|
126 | if(hwndButton == 0) {
|
---|
127 | dprintf(("RegisterSystemClasses failed!!"));
|
---|
128 | }
|
---|
129 | O32_SetClassLong(hwndButton, GCL_WNDPROC, (LONG)ButtonCallback);
|
---|
130 | }
|
---|
131 | if(O32_GetClassInfo(NULL, "LISTBOX", &wndclass)) {
|
---|
132 | dprintf(("Create LISTBOX System class"));
|
---|
133 | ListboxClass = new Win32WindowClass(ListboxCallback, "LISTBOX", hModule);
|
---|
134 | ListboxHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
|
---|
135 | hwndListbox = O32_CreateWindow("LISTBOX", "LISTBOX", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
---|
136 | if(hwndListbox == 0) {
|
---|
137 | dprintf(("RegisterSystemClasses failed!!"));
|
---|
138 | }
|
---|
139 | O32_SetClassLong(hwndListbox, GCL_WNDPROC, (LONG)ListboxCallback);
|
---|
140 | }
|
---|
141 | if(O32_GetClassInfo(NULL, "COMBOBOX", &wndclass)) {
|
---|
142 | dprintf(("Create COMBOBOX System class"));
|
---|
143 | ComboboxClass = new Win32WindowClass(ComboboxCallback, "COMBOBOX", hModule);
|
---|
144 | ComboboxHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
|
---|
145 | hwndCombobox = O32_CreateWindow("COMBOBOX", "COMBOBOX", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
---|
146 | if(hwndCombobox == 0) {
|
---|
147 | dprintf(("RegisterSystemClasses failed!!"));
|
---|
148 | }
|
---|
149 | O32_SetClassLong(hwndCombobox, GCL_WNDPROC, (LONG)ComboboxCallback);
|
---|
150 | }
|
---|
151 | if(O32_GetClassInfo(NULL, "EDIT", &wndclass)) {
|
---|
152 | dprintf(("Create EDIT System class"));
|
---|
153 | EditClass = new Win32WindowClass(EditCallback, "EDIT", hModule);
|
---|
154 | EditHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
|
---|
155 | hwndEdit = O32_CreateWindow("EDIT", "EDIT", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
---|
156 | if(hwndEdit == 0) {
|
---|
157 | dprintf(("RegisterSystemClasses failed!!"));
|
---|
158 | }
|
---|
159 | O32_SetClassLong(hwndEdit, GCL_WNDPROC, (LONG)EditCallback);
|
---|
160 | }
|
---|
161 | //TODO: This doens't work yet!! (need to create a normal window as parent)
|
---|
162 | if(O32_GetClassInfo(NULL, "MDICLIENT", &wndclass)) {
|
---|
163 | dprintf(("Create MDICLIENT System class"));
|
---|
164 | MdiClientClass = new Win32WindowClass(MdiClientCallback, "MDICLIENT", hModule);
|
---|
165 | MdiClientHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
|
---|
166 | hwndMdiClient = O32_CreateWindow("MDICLIENT", "MDICLIENT", WS_CHILD, 0, 0, 0, 0, hwndListbox, 0, 0, 0);
|
---|
167 | if(hwndMdiClient == 0) {
|
---|
168 | dprintf(("RegisterSystemClasses failed!!"));
|
---|
169 | }
|
---|
170 | O32_SetClassLong(hwndMdiClient, GCL_WNDPROC, (LONG)MdiClientCallback);
|
---|
171 | }
|
---|
172 | if(O32_GetClassInfo(NULL, "SCROLLBAR", &wndclass)) {
|
---|
173 | dprintf(("Create SCROLLBAR System class"));
|
---|
174 | ScrollbarClass = new Win32WindowClass(ScrollbarCallback, "SCROLLBAR", hModule);
|
---|
175 | ScrollbarHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
|
---|
176 | hwndScrollbar = O32_CreateWindow("SCROLLBAR", "SCROLLBAR", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
---|
177 | if(hwndScrollbar == 0) {
|
---|
178 | dprintf(("RegisterSystemClasses failed!!"));
|
---|
179 | }
|
---|
180 | O32_SetClassLong(hwndScrollbar, GCL_WNDPROC, (LONG)ScrollbarCallback);
|
---|
181 | }
|
---|
182 | if(O32_GetClassInfo(NULL, "STATIC", &wndclass)) {
|
---|
183 | dprintf(("Create STATIC System class"));
|
---|
184 | StaticClass = new Win32WindowClass(StaticCallback, "STATIC", hModule);
|
---|
185 | StaticHandler = (WNDPROC_O32)wndclass.lpfnWndProc;
|
---|
186 | hwndStatic = O32_CreateWindow("STATIC", "STATIC", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
---|
187 | if(hwndStatic == 0) {
|
---|
188 | dprintf(("RegisterSystemClasses failed!!"));
|
---|
189 | }
|
---|
190 | O32_SetClassLong(hwndStatic, GCL_WNDPROC, (LONG)StaticCallback);
|
---|
191 | }
|
---|
192 | //TODO: More standard classes in win95/NT4?
|
---|
193 | }
|
---|
194 | //******************************************************************************
|
---|
195 | //******************************************************************************
|
---|
196 | void UnregisterSystemClasses()
|
---|
197 | {
|
---|
198 | dprintf(("KERNEL32: UnregisterSystemClasses"));
|
---|
199 | if(hwndButton) O32_DestroyWindow(hwndButton);
|
---|
200 | if(hwndListbox) O32_DestroyWindow(hwndListbox);
|
---|
201 | if(hwndCombobox) O32_DestroyWindow(hwndCombobox);
|
---|
202 | if(hwndMdiClient) O32_DestroyWindow(hwndMdiClient);
|
---|
203 | if(hwndEdit) O32_DestroyWindow(hwndEdit);
|
---|
204 | if(hwndScrollbar) O32_DestroyWindow(hwndScrollbar);
|
---|
205 | if(hwndStatic) O32_DestroyWindow(hwndStatic);
|
---|
206 | if(ButtonClass) delete ButtonClass;
|
---|
207 | if(ListboxClass) delete ListboxClass;
|
---|
208 | if(EditClass) delete EditClass;
|
---|
209 | if(ComboboxClass) delete ComboboxClass;
|
---|
210 | if(MdiClientClass) delete MdiClientClass;
|
---|
211 | if(ScrollbarClass) delete ScrollbarClass;
|
---|
212 | if(StaticClass) delete StaticClass;
|
---|
213 | ButtonClass = NULL;
|
---|
214 | EditClass = NULL;
|
---|
215 | ListboxClass = NULL;
|
---|
216 | ComboboxClass = NULL;
|
---|
217 | MdiClientClass = NULL;
|
---|
218 | ScrollbarClass = NULL;
|
---|
219 | StaticClass = NULL;
|
---|
220 | }
|
---|
221 | //******************************************************************************
|
---|
222 | //SvL: 18-7-'98: Moved here from user32.cpp
|
---|
223 | //******************************************************************************
|
---|
224 | ATOM WIN32API RegisterClassA(const WNDCLASSA *lpWndClass)
|
---|
225 | {
|
---|
226 | ATOM rc;
|
---|
227 | WNDCLASSA wc;
|
---|
228 |
|
---|
229 | #ifdef DEBUG
|
---|
230 | WriteLog("USER32: RegisterClassA\n");
|
---|
231 | WriteLog("USER32: lpWndClass->style %X\n", lpWndClass->style);
|
---|
232 | WriteLog("USER32: lpWndClass->lpfnWndProc %X\n", lpWndClass->lpfnWndProc);
|
---|
233 | WriteLog("USER32: lpWndClass->cbClsExtra %X\n", lpWndClass->cbClsExtra);
|
---|
234 | WriteLog("USER32: lpWndClass->cbWndExtra %X\n", lpWndClass->cbWndExtra);
|
---|
235 | WriteLog("USER32: lpWndClass->hInstance %X\n", lpWndClass->hInstance);
|
---|
236 | WriteLog("USER32: lpWndClass->hIcon %X\n", lpWndClass->hIcon);
|
---|
237 | WriteLog("USER32: lpWndClass->hCursor %X\n", lpWndClass->hCursor);
|
---|
238 | WriteLog("USER32: lpWndClass->hbrBackground %X\n", lpWndClass->hbrBackground);
|
---|
239 | WriteLog("USER32: lpWndClass->lpszMenuName %X\n", lpWndClass->lpszMenuName);
|
---|
240 | if((int)lpWndClass->lpszClassName >> 16 == 0)
|
---|
241 | WriteLog("USER32: lpWndClass->lpszClassName %X\n", lpWndClass->lpszClassName);
|
---|
242 | else WriteLog("USER32: lpWndClass->lpszClassName %s\n", lpWndClass->lpszClassName);
|
---|
243 | #endif
|
---|
244 | memcpy(&wc, lpWndClass, sizeof(WNDCLASSA));
|
---|
245 |
|
---|
246 | if((int)wc.lpszMenuName >> 16 != 0) {//convert string name identifier to numeric id
|
---|
247 | dprintf(("USER32: lpszMenuName %s\n", wc.lpszMenuName));
|
---|
248 | *(int *)&wc.lpszMenuName = ConvertNameId(0, (char *)wc.lpszMenuName);
|
---|
249 | dprintf(("USER32: Menu id = %d\n", (int)wc.lpszMenuName));
|
---|
250 | }
|
---|
251 | #ifdef DEBUG
|
---|
252 | if(wc.style & (CS_PARENTDC | CS_CLASSDC)) {
|
---|
253 | dprintf(("USER32: Class uses an unsupported style!!!\n"));
|
---|
254 | }
|
---|
255 | #endif
|
---|
256 | //These are not supported by Open32
|
---|
257 | wc.style &= ~(CS_PARENTDC | CS_CLASSDC);
|
---|
258 |
|
---|
259 | //SvL: 18-7-'98 Breaks apps (solitaire, rasmol..)
|
---|
260 | #if 0
|
---|
261 | /* @@@PH 98/06/21 experimental fix for WInhlp32 */
|
---|
262 | #ifndef CS_SYNCPAINT
|
---|
263 | #define CS_SYNCPAINT 0x02000000L
|
---|
264 | #endif
|
---|
265 |
|
---|
266 | wc.style |= CS_SYNCPAINT;
|
---|
267 | #endif
|
---|
268 |
|
---|
269 | wc.lpfnWndProc = (WNDPROC)Win32WindowClass::GetOS2ClassCallback();
|
---|
270 | rc = O32_RegisterClass(&wc);
|
---|
271 | if(rc) {
|
---|
272 | Win32WindowClass *wndclass = new Win32WindowClass((WNDPROC)lpWndClass->lpfnWndProc, (LPSTR)wc.lpszClassName, wc.hInstance);
|
---|
273 | }
|
---|
274 | dprintf(("USER32: RegisterClass returned %d (%d)\n", rc, GetLastError()));
|
---|
275 | return(rc);
|
---|
276 | }
|
---|
277 | //******************************************************************************
|
---|
278 | //SvL: 18-7-'98: Moved here from user32.cpp
|
---|
279 | //******************************************************************************
|
---|
280 | ATOM WIN32API RegisterClassExA(const WNDCLASSEXA *lpWndClass)
|
---|
281 | {
|
---|
282 | ATOM rc;
|
---|
283 | WNDCLASSEXA wc;
|
---|
284 |
|
---|
285 | #ifdef DEBUG
|
---|
286 | WriteLog("USER32: lpWndClass->cbSize %X\n", lpWndClass->cbSize);
|
---|
287 | WriteLog("USER32: lpWndClass->style %X\n", lpWndClass->style);
|
---|
288 | WriteLog("USER32: lpWndClass->lpfnWndProc %X\n", lpWndClass->lpfnWndProc);
|
---|
289 | WriteLog("USER32: lpWndClass->cbClsExtra %X\n", lpWndClass->cbClsExtra);
|
---|
290 | WriteLog("USER32: lpWndClass->cbWndExtra %X\n", lpWndClass->cbWndExtra);
|
---|
291 | WriteLog("USER32: lpWndClass->hInstance %X\n", lpWndClass->hInstance);
|
---|
292 | WriteLog("USER32: lpWndClass->hIcon %X\n", lpWndClass->hIcon);
|
---|
293 | WriteLog("USER32: lpWndClass->hCursor %X\n", lpWndClass->hCursor);
|
---|
294 | WriteLog("USER32: lpWndClass->hbrBackground %X\n", lpWndClass->hbrBackground);
|
---|
295 | WriteLog("USER32: lpWndClass->lpszMenuName %X\n", lpWndClass->lpszMenuName);
|
---|
296 | if((int)lpWndClass->lpszClassName >> 16 == 0)
|
---|
297 | WriteLog("USER32: lpWndClass->lpszClassName %X\n", lpWndClass->lpszClassName);
|
---|
298 | else WriteLog("USER32: lpWndClass->lpszClassName %s\n", lpWndClass->lpszClassName);
|
---|
299 | #endif
|
---|
300 | memcpy(&wc, lpWndClass, sizeof(WNDCLASSEXA));
|
---|
301 |
|
---|
302 | if((int)wc.lpszMenuName >> 16 != 0) {//convert string name identifier to numeric id
|
---|
303 | dprintf(("USER32: lpszMenuName %s\n", wc.lpszMenuName));
|
---|
304 | *(int *)&wc.lpszMenuName = ConvertNameId(0, (char *)wc.lpszMenuName);
|
---|
305 | dprintf(("USER32: Menu id = %d\n", (int)wc.lpszMenuName));
|
---|
306 | }
|
---|
307 | if(wc.cbSize != sizeof(WNDCLASSEXA))
|
---|
308 | return(0);
|
---|
309 |
|
---|
310 | #ifdef DEBUG
|
---|
311 | if(wc.style & (CS_PARENTDC | CS_CLASSDC)) {
|
---|
312 | dprintf(("USER32: Class uses an unsupported style!!!\n"));
|
---|
313 | }
|
---|
314 | #endif
|
---|
315 | //These are not supported by Open32
|
---|
316 | wc.style &= ~(CS_PARENTDC | CS_CLASSDC);
|
---|
317 |
|
---|
318 | wc.lpfnWndProc = (WNDPROC)Win32WindowClass::GetOS2ClassCallback();
|
---|
319 |
|
---|
320 | rc = O32_RegisterClass((WNDCLASSA *)&wc.style);
|
---|
321 | if(rc) {
|
---|
322 | Win32WindowClass *wndclass = new Win32WindowClass((WNDPROC)lpWndClass->lpfnWndProc, (LPSTR)wc.lpszClassName, wc.hInstance);
|
---|
323 | }
|
---|
324 | #ifdef DEBUG
|
---|
325 | WriteLog("USER32: RegisterClassExA, not completely supported, returned %d\n", rc);
|
---|
326 | if(rc == 0)
|
---|
327 | WriteLog("USER32: GetLastError returned %X\n", GetLastError());
|
---|
328 |
|
---|
329 | #endif
|
---|
330 | return(rc);
|
---|
331 | }
|
---|
332 | //******************************************************************************
|
---|
333 | //******************************************************************************
|
---|
334 | WORD WIN32API RegisterClassW(const WNDCLASSW *lpwc)
|
---|
335 | {
|
---|
336 | ATOM rc;
|
---|
337 | WNDCLASSA wclass;
|
---|
338 |
|
---|
339 | dprintf(("RegisterClassW\n"));
|
---|
340 | memcpy(&wclass, lpwc, sizeof(WNDCLASSA));
|
---|
341 | if(wclass.lpszMenuName && ((int)wclass.lpszMenuName >> 16 != 0)) {
|
---|
342 | wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
|
---|
343 | }
|
---|
344 | if(wclass.lpszClassName && ((int)wclass.lpszClassName >> 16 != 0)) {
|
---|
345 | wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
|
---|
346 | }
|
---|
347 |
|
---|
348 | rc = RegisterClassA(&wclass);
|
---|
349 |
|
---|
350 | //TODO: Assuming RegisterClass doesn't mess up our structure
|
---|
351 | if(lpwc->lpszMenuName && ((int)lpwc->lpszMenuName >> 16 != 0)) {
|
---|
352 | FreeAsciiString((char *)wclass.lpszMenuName);
|
---|
353 | }
|
---|
354 | if(lpwc->lpszClassName && ((int)lpwc->lpszClassName >> 16 != 0)) {
|
---|
355 | FreeAsciiString((char *)wclass.lpszClassName);
|
---|
356 | }
|
---|
357 | return(rc);
|
---|
358 | }
|
---|
359 | //******************************************************************************
|
---|
360 | //******************************************************************************
|
---|
361 | ATOM WIN32API RegisterClassExW(CONST WNDCLASSEXW *lpwc)
|
---|
362 | {
|
---|
363 | ATOM rc;
|
---|
364 | WNDCLASSEXA wclass;
|
---|
365 |
|
---|
366 | dprintf(("RegisterClassExW\n"));
|
---|
367 | memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA));
|
---|
368 | if(wclass.lpszMenuName && ((int)wclass.lpszMenuName >> 16 != 0)) {
|
---|
369 | wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
|
---|
370 | }
|
---|
371 | if(wclass.lpszClassName && ((int)wclass.lpszClassName >> 16 != 0)) {
|
---|
372 | wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
|
---|
373 | }
|
---|
374 |
|
---|
375 | rc = RegisterClassExA(&wclass);
|
---|
376 |
|
---|
377 | //TODO: Assuming RegisterClassEx doesn't mess up our structure
|
---|
378 | if(lpwc->lpszMenuName && ((int)lpwc->lpszMenuName >> 16 != 0)) {
|
---|
379 | FreeAsciiString((char *)wclass.lpszMenuName);
|
---|
380 | }
|
---|
381 | if(lpwc->lpszClassName && ((int)lpwc->lpszClassName >> 16 != 0)) {
|
---|
382 | FreeAsciiString((char *)wclass.lpszClassName);
|
---|
383 | }
|
---|
384 | return(rc);
|
---|
385 | }
|
---|
386 | //******************************************************************************
|
---|
387 | //******************************************************************************
|
---|
388 | BOOL WIN32API UnregisterClassA(LPCSTR lpszClassName, HINSTANCE hinst)
|
---|
389 | {
|
---|
390 | BOOL rc;
|
---|
391 |
|
---|
392 | Win32WindowClass::UnregisterClass(hinst, (LPSTR)lpszClassName);
|
---|
393 | rc = O32_UnregisterClass(lpszClassName, hinst);
|
---|
394 | dprintf(("USER32: OS2UnregisterClassA returned %d\n", rc));
|
---|
395 |
|
---|
396 | //Spintest returns FALSE in dll termination, so pretend it succeeded
|
---|
397 | return(TRUE);
|
---|
398 | }
|
---|
399 | //******************************************************************************
|
---|
400 | //******************************************************************************
|
---|
401 | BOOL WIN32API UnregisterClassW(LPCWSTR lpszClassName, HINSTANCE hinst)
|
---|
402 | {
|
---|
403 | char *astring = NULL;
|
---|
404 | BOOL rc;
|
---|
405 |
|
---|
406 | dprintf(("USER32: OS2UnregisterClassW\n"));
|
---|
407 | if((int)lpszClassName >> 16 != 0) {
|
---|
408 | astring = UnicodeToAsciiString((LPWSTR)lpszClassName);
|
---|
409 | }
|
---|
410 | else astring = (char *)lpszClassName;
|
---|
411 |
|
---|
412 | Win32WindowClass::UnregisterClass(hinst, (LPSTR)astring);
|
---|
413 | rc = O32_UnregisterClass(astring, hinst);
|
---|
414 | if((int)astring >> 16 != 0) {
|
---|
415 | FreeAsciiString(astring);
|
---|
416 | }
|
---|
417 | //Spintest returns FALSE in dll termination, so pretend it succeeded
|
---|
418 | return(TRUE);
|
---|
419 | }
|
---|
420 | //******************************************************************************
|
---|
421 | //******************************************************************************
|
---|
422 | BOOL WIN32API GetClassInfoA(HINSTANCE arg1, LPCSTR arg2, WNDCLASSA * arg3)
|
---|
423 | {
|
---|
424 | BOOL rc;
|
---|
425 |
|
---|
426 | dprintf(("USER32: OS2GetClassInfoA\n"));
|
---|
427 | rc = O32_GetClassInfo(arg1, arg2, (WNDCLASSA *)arg3);
|
---|
428 | if(rc == TRUE) {
|
---|
429 | arg3->lpfnWndProc = (WNDPROC)Win32WindowClass::GetClassCallback((LPSTR)arg2);
|
---|
430 | }
|
---|
431 | return(rc);
|
---|
432 | }
|
---|
433 | //******************************************************************************
|
---|
434 | //******************************************************************************
|
---|
435 | BOOL WIN32API GetClassInfoW(HINSTANCE hinst,
|
---|
436 | LPCWSTR lpszClass,
|
---|
437 | WNDCLASSW *lpwc)
|
---|
438 | {
|
---|
439 | WNDCLASSA wclass;
|
---|
440 | BOOL rc;
|
---|
441 | char *szClass = NULL;
|
---|
442 |
|
---|
443 | dprintf(("USER32: OS2GetClassInfoW\n"));
|
---|
444 | if((int)lpszClass >> 16 != 0) {
|
---|
445 | szClass = UnicodeToAsciiString((LPWSTR)lpszClass);
|
---|
446 | dprintf(("USER32: OS2GetClassInfoW %s\n", szClass));
|
---|
447 | }
|
---|
448 | else szClass = (char *)lpszClass;
|
---|
449 |
|
---|
450 | rc = GetClassInfoA(hinst, szClass, &wclass);
|
---|
451 | if(rc == TRUE) {
|
---|
452 | memcpy(lpwc, &wclass, sizeof(WNDCLASSA));
|
---|
453 | //TODO: Memory leak (create class object at RegisterClass and delete it at UnregisterClass)
|
---|
454 | if(lpwc->lpszMenuName && ((int)lpwc->lpszMenuName >> 16 != 0)) {
|
---|
455 | lpwc->lpszMenuName = (LPCWSTR)malloc(strlen(wclass.lpszMenuName)*sizeof(WCHAR)+2);
|
---|
456 | AsciiToUnicode((char *)wclass.lpszMenuName, (LPWSTR)lpwc->lpszMenuName);
|
---|
457 | }
|
---|
458 | if(lpwc->lpszClassName && ((int)lpwc->lpszClassName >> 16 != 0)) {
|
---|
459 | lpwc->lpszClassName = (LPCWSTR)malloc(strlen(wclass.lpszClassName)*sizeof(WCHAR)+2);
|
---|
460 | AsciiToUnicode((char *)wclass.lpszClassName, (LPWSTR)lpwc->lpszClassName);
|
---|
461 | }
|
---|
462 | }
|
---|
463 | dprintf(("USER32: OS2GetClassInfoW returned %d\n", rc));
|
---|
464 | return(rc);
|
---|
465 | }
|
---|
466 | /****************************************************************************
|
---|
467 | * Name : BOOL WIN32API GetClassInfoExA
|
---|
468 | * Purpose : The GetClassInfoEx function retrieves information about a window
|
---|
469 | * class, including the handle of the small icon associated with the
|
---|
470 | * window class. GetClassInfo does not retrieve the handle of the small icon.
|
---|
471 | * Parameters: HINSTANCE hinst handle of application instance
|
---|
472 | * LPCTSTR lpszClass address of class name string
|
---|
473 | * LPWNDCLASSEX lpwcx address of structure for class data
|
---|
474 | * Variables :
|
---|
475 | * Result : If the function finds a matching class and successfully copies
|
---|
476 | * the data, the return value is TRUE;
|
---|
477 | * otherwise, it is FALSE.
|
---|
478 | * To get extended error information, call GetLastError.
|
---|
479 | * Remark : PH: does not obtain handle of the small icon
|
---|
480 | * Status : UNTESTED STUB
|
---|
481 | *
|
---|
482 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
---|
483 | *****************************************************************************/
|
---|
484 | BOOL WIN32API GetClassInfoExA(HINSTANCE hInstance,
|
---|
485 | LPCTSTR lpszClass,
|
---|
486 | LPWNDCLASSEXA lpwcx)
|
---|
487 | {
|
---|
488 | WNDCLASSA WndClass; /* structure for data transformation */
|
---|
489 | BOOL bResult; /* result of subsequent function calls */
|
---|
490 |
|
---|
491 | dprintf(("USER32:GetClassInfoExA (%08xh,%s,%08x).\n",
|
---|
492 | hInstance,
|
---|
493 | lpszClass,
|
---|
494 | lpwcx));
|
---|
495 |
|
---|
496 | /* convert the structures */
|
---|
497 | memcpy((PVOID)&WndClass,
|
---|
498 | (PVOID)&lpwcx->style,
|
---|
499 | sizeof(WndClass) );
|
---|
500 |
|
---|
501 | bResult = GetClassInfoA(hInstance,
|
---|
502 | lpszClass,
|
---|
503 | (WNDCLASSA *)&WndClass);
|
---|
504 | if (bResult == TRUE)
|
---|
505 | {
|
---|
506 | /* convert data back to original structure */
|
---|
507 | memcpy((PVOID)&lpwcx->style,
|
---|
508 | (PVOID)&WndClass,
|
---|
509 | sizeof(WndClass) );
|
---|
510 | lpwcx->cbSize = sizeof(WNDCLASSEXA);
|
---|
511 | lpwcx->hIconSm = 0;
|
---|
512 | }
|
---|
513 |
|
---|
514 | return (bResult);
|
---|
515 | }
|
---|
516 | /*****************************************************************************
|
---|
517 | * Name : BOOL WIN32API GetClassInfoExW
|
---|
518 | * Purpose : The GetClassInfoEx function retrieves information about a window
|
---|
519 | * class, including the handle of the small icon associated with the
|
---|
520 | * window class. GetClassInfo does not retrieve the handle of the small icon.
|
---|
521 | * Parameters: HINSTANCE hinst handle of application instance
|
---|
522 | * LPCWSTR lpszClass address of class name string
|
---|
523 | * LPWNDCLASSEX lpwcx address of structure for class data
|
---|
524 | * Variables :
|
---|
525 | * Result : If the function finds a matching class and successfully copies
|
---|
526 | * the data, the return value is TRUE;
|
---|
527 | * otherwise, it is FALSE.
|
---|
528 | * To get extended error information, call GetLastError.
|
---|
529 | * Remark : does not obtain handle of the small icon
|
---|
530 | * Status : UNTESTED STUB
|
---|
531 | *
|
---|
532 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
---|
533 | *****************************************************************************/
|
---|
534 | BOOL WIN32API GetClassInfoExW(HINSTANCE hInstance,
|
---|
535 | LPCWSTR lpszClass,
|
---|
536 | LPWNDCLASSEXW lpwcx)
|
---|
537 | {
|
---|
538 | WNDCLASSW WndClass; /* structure for data transformation */
|
---|
539 | BOOL bResult; /* result of subsequent function calls */
|
---|
540 |
|
---|
541 | dprintf(("USER32:GetClassInfoExW (%08xh,%s,%08x).\n",
|
---|
542 | hInstance,
|
---|
543 | lpszClass,
|
---|
544 | lpwcx));
|
---|
545 |
|
---|
546 | /* convert the structures */
|
---|
547 | memcpy((PVOID)&WndClass,
|
---|
548 | (PVOID)&lpwcx->style,
|
---|
549 | sizeof(WndClass) );
|
---|
550 |
|
---|
551 | bResult = GetClassInfoW(hInstance,
|
---|
552 | (LPWSTR)lpszClass,
|
---|
553 | (WNDCLASSW *)&WndClass);
|
---|
554 | if (bResult == TRUE)
|
---|
555 | {
|
---|
556 | /* convert data back to original structure */
|
---|
557 | memcpy((PVOID)&lpwcx->style,
|
---|
558 | (PVOID)&WndClass,
|
---|
559 | sizeof(WndClass) );
|
---|
560 | lpwcx->cbSize = sizeof(WNDCLASSEXW);
|
---|
561 | lpwcx->hIconSm = 0;
|
---|
562 | }
|
---|
563 |
|
---|
564 | return (bResult);
|
---|
565 | }
|
---|
566 | //******************************************************************************
|
---|
567 | //TODO: Not complete (unsupported extension in WNDCLASSEXA/W, unsupported styles etc)
|
---|
568 | //******************************************************************************
|
---|
569 | LONG WIN32API GetClassLongA(HWND hwnd, int nIndex)
|
---|
570 | {
|
---|
571 | DWORD rc;
|
---|
572 |
|
---|
573 | dprintf(("USER32: OS2GetClassLongA\n"));
|
---|
574 | rc = O32_GetClassLong(hwnd, nIndex);
|
---|
575 | if(nIndex == GCL_WNDPROC) {
|
---|
576 | char szClass[128];
|
---|
577 | Win32WindowClass *wclass;
|
---|
578 |
|
---|
579 | if(GetClassNameA(hwnd, szClass, sizeof(szClass))) {
|
---|
580 | wclass = Win32WindowClass::FindClass(szClass);
|
---|
581 | if(wclass) {
|
---|
582 | return (LONG)wclass->GetWinCallback();
|
---|
583 | }
|
---|
584 | }
|
---|
585 | dprintf(("GetClassLongA, class of window %X not found\n", hwnd));
|
---|
586 | return 0; //TODO: set last error
|
---|
587 | }
|
---|
588 | return rc;
|
---|
589 | }
|
---|
590 | //******************************************************************************
|
---|
591 | //******************************************************************************
|
---|
592 | LONG WIN32API GetClassLongW(HWND hwnd, int nIndex)
|
---|
593 | {
|
---|
594 | dprintf(("USER32: OS2GetClassLongW\n"));
|
---|
595 | if(nIndex == GCL_MENUNAME) { //TODO
|
---|
596 | dprintf(("USER32: Class Menu name not implemented yet\n"));
|
---|
597 | }
|
---|
598 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
599 | return GetClassLongA(hwnd, nIndex);
|
---|
600 | }
|
---|
601 | //******************************************************************************
|
---|
602 | //******************************************************************************
|
---|
603 | int WIN32API GetClassNameA( HWND arg1, LPSTR arg2, int arg3)
|
---|
604 | {
|
---|
605 | dprintf(("USER32: OS2GetClassNameA\n"));
|
---|
606 | return O32_GetClassName(arg1, arg2, arg3);
|
---|
607 | }
|
---|
608 | //******************************************************************************
|
---|
609 | //******************************************************************************
|
---|
610 | int WIN32API GetClassNameW(HWND hwnd, LPWSTR lpClassName, int nMaxCount)
|
---|
611 | {
|
---|
612 | char *astring = (char *)malloc(nMaxCount);
|
---|
613 | int rc;
|
---|
614 |
|
---|
615 | dprintf(("USER32: OS2GetClassNameW\n"));
|
---|
616 | rc = GetClassNameA(hwnd, astring, nMaxCount);
|
---|
617 | AsciiToUnicode(astring, lpClassName);
|
---|
618 | free(astring);
|
---|
619 | return(rc);
|
---|
620 | }
|
---|
621 | //******************************************************************************
|
---|
622 | //******************************************************************************
|
---|
623 | WORD WIN32API GetClassWord( HWND arg1, int arg2)
|
---|
624 | {
|
---|
625 | dprintf(("USER32: OS2GetClassWord\n"));
|
---|
626 | return O32_GetClassWord(arg1, arg2);
|
---|
627 | }
|
---|
628 | //******************************************************************************
|
---|
629 | //******************************************************************************
|
---|
630 | LONG WIN32API SetClassLongA(HWND hwnd, int nIndex, LONG lNewVal)
|
---|
631 | {
|
---|
632 | DWORD rc;
|
---|
633 |
|
---|
634 | dprintf(("USER32: OS2SetClassLongA\n"));
|
---|
635 | if(nIndex == GCL_WNDPROC) {
|
---|
636 | char szClass[128];
|
---|
637 | Win32WindowClass *wclass;
|
---|
638 |
|
---|
639 | if(GetClassNameA(hwnd, szClass, sizeof(szClass))) {
|
---|
640 | wclass = Win32WindowClass::FindClass(szClass);
|
---|
641 | if(wclass) {
|
---|
642 | rc = (DWORD)wclass->GetWinCallback();
|
---|
643 | wclass->SetWinCallback((WNDPROC)lNewVal);
|
---|
644 | return rc;
|
---|
645 | }
|
---|
646 | }
|
---|
647 | dprintf(("SetClassLongA, class of window %X not found\n", hwnd));
|
---|
648 | return 0; //TODO: set last error
|
---|
649 | }
|
---|
650 | return O32_SetClassLong(hwnd, nIndex, lNewVal);
|
---|
651 | }
|
---|
652 | //******************************************************************************
|
---|
653 | //******************************************************************************
|
---|
654 | LONG WIN32API SetClassLongW( HWND arg1, int arg2, LONG arg3)
|
---|
655 | {
|
---|
656 | dprintf(("USER32: OS2SetClassLongW\n"));
|
---|
657 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
658 | return O32_SetClassLong(arg1, arg2, arg3);
|
---|
659 | }
|
---|
660 | //******************************************************************************
|
---|
661 | //******************************************************************************
|
---|
662 | WORD WIN32API SetClassWord( HWND arg1, int arg2, WORD arg3)
|
---|
663 | {
|
---|
664 | dprintf(("USER32: OS2SetClassWord\n"));
|
---|
665 | return O32_SetClassWord(arg1, arg2, arg3);
|
---|
666 | }
|
---|
667 | //******************************************************************************
|
---|
668 | //Win32WindowClass methods:
|
---|
669 | //******************************************************************************
|
---|
670 | Win32WindowClass::Win32WindowClass(WNDPROC pUserCallback, LPSTR id, HINSTANCE hinst)
|
---|
671 | {
|
---|
672 | //Insert it in front of the rest
|
---|
673 | next = wndclasses;
|
---|
674 | wndclasses = this;
|
---|
675 | if((int)id >> 16 != 0) {
|
---|
676 | strcpy(className, id);
|
---|
677 | classAtom = 0;
|
---|
678 | }
|
---|
679 | else {
|
---|
680 | className[0] = 0;
|
---|
681 | classAtom = (DWORD)id;
|
---|
682 | }
|
---|
683 | this->hinst = hinst;
|
---|
684 |
|
---|
685 | pWinCallback = pUserCallback;
|
---|
686 | dprintf(("Win32WindowClass::Win32WindowClass %d\n", id));
|
---|
687 | }
|
---|
688 | //******************************************************************************
|
---|
689 | //******************************************************************************
|
---|
690 | Win32WindowClass::~Win32WindowClass()
|
---|
691 | {
|
---|
692 | Win32WindowClass *wndclass = Win32WindowClass::wndclasses;
|
---|
693 |
|
---|
694 | if(wndclass == this) {
|
---|
695 | wndclasses = next;
|
---|
696 | }
|
---|
697 | else {
|
---|
698 | while(wndclass->next != NULL) {
|
---|
699 | if(wndclass->next == this) {
|
---|
700 | wndclass->next = next;
|
---|
701 | break;
|
---|
702 | }
|
---|
703 | wndclass = wndclass->next;
|
---|
704 | }
|
---|
705 | }
|
---|
706 | }
|
---|
707 | //******************************************************************************
|
---|
708 | //******************************************************************************
|
---|
709 | Win32WindowClass *Win32WindowClass::FindClass(LPSTR id)
|
---|
710 | {
|
---|
711 | Win32WindowClass *wndclass = wndclasses;
|
---|
712 |
|
---|
713 | if(wndclass == NULL) return(NULL);
|
---|
714 |
|
---|
715 | if((int)id >> 16 != 0) {
|
---|
716 | if(stricmp(wndclass->className, id) == 0) {
|
---|
717 | return(wndclass);
|
---|
718 | }
|
---|
719 | else {
|
---|
720 | wndclass = wndclass->next;
|
---|
721 | while(wndclass != NULL) {
|
---|
722 | if(stricmp(wndclass->className, id) == 0) {
|
---|
723 | return(wndclass);
|
---|
724 | }
|
---|
725 | wndclass = wndclass->next;
|
---|
726 | }
|
---|
727 | }
|
---|
728 | }
|
---|
729 | else {
|
---|
730 | if(wndclass->classAtom == (DWORD)id) {
|
---|
731 | return(wndclass);
|
---|
732 | }
|
---|
733 | else {
|
---|
734 | wndclass = wndclass->next;
|
---|
735 | while(wndclass != NULL) {
|
---|
736 | if(wndclass->classAtom == (DWORD)id) {
|
---|
737 | return(wndclass);
|
---|
738 | }
|
---|
739 | wndclass = wndclass->next;
|
---|
740 | }
|
---|
741 | }
|
---|
742 | }
|
---|
743 | return(NULL);
|
---|
744 | }
|
---|
745 | //******************************************************************************
|
---|
746 | //******************************************************************************
|
---|
747 | void Win32WindowClass::UnregisterClass(HINSTANCE hinst, LPSTR id)
|
---|
748 | {
|
---|
749 | Win32WindowClass *wndclass;
|
---|
750 |
|
---|
751 | dprintf(("::UnregisterClass, destroy class %X!!\n", id));
|
---|
752 | wndclass = FindClass(id);
|
---|
753 | if(wndclass && wndclass->hinst == hinst) {
|
---|
754 | delete wndclass;
|
---|
755 | return;
|
---|
756 | }
|
---|
757 | dprintf(("::UnregisterClass, couldn't find class %X!!\n", id));
|
---|
758 | }
|
---|
759 | //******************************************************************************
|
---|
760 | //******************************************************************************
|
---|
761 | WNDPROC Win32WindowClass::GetClassCallback(HINSTANCE hinst, LPSTR id)
|
---|
762 | {
|
---|
763 | Win32WindowClass *wndclass;
|
---|
764 |
|
---|
765 | wndclass = FindClass(id);
|
---|
766 | if(wndclass && wndclass->hinst == hinst) {
|
---|
767 | return wndclass->pWinCallback;
|
---|
768 | }
|
---|
769 | dprintf(("::GetClassCallback, couldn't find class %X!!\n", id));
|
---|
770 | return(NULL);
|
---|
771 | }
|
---|
772 | //******************************************************************************
|
---|
773 | //******************************************************************************
|
---|
774 | WNDPROC Win32WindowClass::GetClassCallback(LPSTR id)
|
---|
775 | {
|
---|
776 | Win32WindowClass *wndclass;
|
---|
777 |
|
---|
778 | wndclass = FindClass(id);
|
---|
779 | if(wndclass) {
|
---|
780 | return wndclass->pWinCallback;
|
---|
781 | }
|
---|
782 | dprintf(("::GetClassCallback2, couldn't find class %X!!\n", id));
|
---|
783 | return(NULL);
|
---|
784 | }
|
---|
785 | //******************************************************************************
|
---|
786 | //******************************************************************************
|
---|
787 | WNDPROC_O32 Win32WindowClass::GetOS2ClassCallback()
|
---|
788 | {
|
---|
789 | return OS2ToWinCallback;
|
---|
790 | }
|
---|
791 | //******************************************************************************
|
---|
792 | //******************************************************************************
|
---|
793 | LRESULT EXPENTRY_O32 OS2ToWinCallback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
794 | {
|
---|
795 | char szClass[128];
|
---|
796 | Win32WindowClass *wclass;
|
---|
797 | LRESULT rc;
|
---|
798 | DWORD dwStyle, dwExStyle;
|
---|
799 | HWND parentHwnd;
|
---|
800 | Win32WindowProc *window;
|
---|
801 |
|
---|
802 | #ifdef DEBUG
|
---|
803 | dprintf(("OS2ToWinCallback for message %s", GetMsgText(Msg)));
|
---|
804 | #endif
|
---|
805 |
|
---|
806 | if(HkCBT::OS2HkCBTProc(hwnd, Msg, wParam, lParam) == TRUE) {//hook swallowed msg
|
---|
807 | return(0);
|
---|
808 | }
|
---|
809 |
|
---|
810 | if(O32_GetClassName(hwnd, szClass, sizeof(szClass))) {
|
---|
811 | wclass = Win32WindowClass::FindClass(szClass);
|
---|
812 | if(wclass) {
|
---|
813 | switch(Msg)
|
---|
814 | {
|
---|
815 | case WM_CREATE://Open32 isn't sending WM_NCCREATE messages!!
|
---|
816 | window = Win32WindowProc::FindProc(hwnd, GetCurrentThreadId());
|
---|
817 | if(window) {
|
---|
818 | dprintf(("OS2ToWinCallback (class): New window object!"));
|
---|
819 | window->SetWindowHandle(hwnd);
|
---|
820 | }
|
---|
821 |
|
---|
822 | if(wclass->GetWinCallback()(hwnd, WM_NCCREATE, 0, lParam) == 0) {
|
---|
823 | dprintf(("WM_NCCREATE returned FALSE\n"));
|
---|
824 | return(-1); //don't create window
|
---|
825 | }
|
---|
826 | //Send WM_CREATE message before notifying parent
|
---|
827 | rc = wclass->GetWinCallback()(hwnd, Msg, wParam, lParam);
|
---|
828 |
|
---|
829 | NotifyParent(hwnd, WM_CREATE, wParam, lParam);
|
---|
830 | return(rc);
|
---|
831 |
|
---|
832 | case WM_DESTROY: //nofity parent
|
---|
833 | case WM_LBUTTONDOWN:
|
---|
834 | case WM_MBUTTONDOWN:
|
---|
835 | case WM_RBUTTONDOWN:
|
---|
836 | NotifyParent(hwnd, Msg, wParam, lParam);
|
---|
837 | break;
|
---|
838 |
|
---|
839 | case WM_KEYDOWN:
|
---|
840 | case WM_KEYUP:
|
---|
841 | case WM_CHAR: //SvL: Correct Open32 key mapping bug
|
---|
842 | lParam = MapOEMToRealKey(wParam, lParam);
|
---|
843 | break;
|
---|
844 | case WM_ACTIVATE:
|
---|
845 | if(LOWORD(wParam) != WA_INACTIVE)
|
---|
846 | {//SvL: Bugfix, Open32 is NOT sending this to the window (messes up Solitaire)
|
---|
847 | HDC hdc = GetDC(hwnd);
|
---|
848 |
|
---|
849 | wclass->GetWinCallback()(hwnd, WM_ERASEBKGND, hdc, 0);
|
---|
850 | ReleaseDC(hwnd, hdc);
|
---|
851 | }
|
---|
852 | break;
|
---|
853 | }
|
---|
854 | return wclass->GetWinCallback()(hwnd, Msg, wParam, lParam);
|
---|
855 | }
|
---|
856 | }
|
---|
857 | dprintf(("OS2ToWinCallback: couldn't find class procedure of window %X\n", hwnd));
|
---|
858 | return(0);
|
---|
859 | }
|
---|
860 | //******************************************************************************
|
---|
861 | //******************************************************************************
|
---|
862 | LRESULT WIN32API WinToOS2Callback(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
---|
863 | {
|
---|
864 | WNDPROC_O32 os2callback;
|
---|
865 |
|
---|
866 | os2callback = (WNDPROC_O32)GetClassLongA(hwnd, GCL_WNDPROC);
|
---|
867 | if(os2callback) {
|
---|
868 | return os2callback(hwnd, Msg, wParam, lParam);
|
---|
869 | }
|
---|
870 | dprintf(("OS2ToWinCallback: window procedure == NULL!!\n"));
|
---|
871 | return(0);
|
---|
872 | }
|
---|
873 | //******************************************************************************
|
---|
874 | //******************************************************************************
|
---|
875 | Win32WindowClass *Win32WindowClass::wndclasses = NULL;
|
---|