1 | /* $Id: win32class.cpp,v 1.1 1999-05-24 20:20:04 ktk Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 Window Class Managment Code for OS/2
|
---|
5 | *
|
---|
6 | *
|
---|
7 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
8 | *
|
---|
9 | */
|
---|
10 | #include <os2win.h>
|
---|
11 | #include <stdarg.h>
|
---|
12 | #include <assert.h>
|
---|
13 | #include "misc.h"
|
---|
14 | #include "user32.h"
|
---|
15 | #include "win32class.h"
|
---|
16 | #include "win32wnd.h"
|
---|
17 |
|
---|
18 | //******************************************************************************
|
---|
19 | //Win32WndClass methods:
|
---|
20 | //******************************************************************************
|
---|
21 | Win32WndClass::Win32WndClass(WNDCLASSEXA wndclass, BOOL isUnicode)
|
---|
22 | {
|
---|
23 | //Insert it in front of the rest
|
---|
24 | next = wndclasses;
|
---|
25 | wndclasses = this;
|
---|
26 | if((ULONG)wndclass->lpszClassName >> 16 != 0) {
|
---|
27 | className = (char *) malloc(strlen(wndclass->lpszClassName)+1);
|
---|
28 | classNameW = (WCHAR *)malloc((strlen(wndclass->lpszClassName)+1)*sizeof(WCHAR));
|
---|
29 | if(className == NULL || classNameW == NULL) {
|
---|
30 | dprintf(("Win32Class ctr; className/classNameW == NULL"));
|
---|
31 | exit(1);
|
---|
32 | }
|
---|
33 | strcpy(className, wndclass->lpszClassName);
|
---|
34 | AsciiToUnicode(className, classNameW);
|
---|
35 | classAtom = GlobalAddAtom(className);
|
---|
36 | }
|
---|
37 | else {
|
---|
38 | className = NULL;
|
---|
39 | classNameW = NULL;
|
---|
40 | classAtom = (DWORD)wndclass->lpszClassName;
|
---|
41 | }
|
---|
42 | this->isUnicode = isUnicode;
|
---|
43 |
|
---|
44 | dprintf(("USER32: Win32Class ctor\n"));
|
---|
45 | dprintf(("USER32: wndclass->style %X\n", wndclass->style));
|
---|
46 | dprintf(("USER32: wndclass->lpfnWndProc %X\n", wndclass->lpfnWndProc));
|
---|
47 | dprintf(("USER32: wndclass->cbClsExtra %X\n", wndclass->cbClsExtra));
|
---|
48 | dprintf(("USER32: wndclass->cbWndExtra %X\n", wndclass->cbWndExtra));
|
---|
49 | dprintf(("USER32: wndclass->hInstance %X\n", wndclass->hInstance));
|
---|
50 | dprintf(("USER32: wndclass->hIcon %X\n", wndclass->hIcon));
|
---|
51 | dprintf(("USER32: wndclass->hCursor %X\n", wndclass->hCursor));
|
---|
52 | dprintf(("USER32: wndclass->hbrBackground %X\n", wndclass->hbrBackground));
|
---|
53 | if((ULONG)wndclass->lpszClassName >> 16 == 0)
|
---|
54 | dprintf(("USER32: wndclass->lpszClassName %X\n", wndclass->lpszClassName));
|
---|
55 | else dprintf(("USER32: wndclass->lpszClassName %s\n", wndclass->lpszClassName));
|
---|
56 |
|
---|
57 | if((ULONG)wc.lpszMenuName >> 16 != 0) {//convert string name identifier to numeric id
|
---|
58 | dprintf(("USER32: lpszMenuName %s\n", wndclass->lpszMenuName));
|
---|
59 | }
|
---|
60 | else dprintf(("USER32: wndclass->lpszMenuName %X\n", wndclass->lpszMenuName));
|
---|
61 |
|
---|
62 | nrExtraClassWords = wndclass->cbClsExtra;
|
---|
63 | nrExtraWindowWords = wndclass->cbWndExtra;
|
---|
64 | backgroundBrush = wndclass->hbrBackGround; //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL
|
---|
65 | hCursor = wndclass->hCursor;
|
---|
66 | hIcon = wndclass->hIcon;
|
---|
67 | hInstance = wndclass->hInstance;
|
---|
68 | if(wndclass->lpszMenuName && (ULONG)wndclass->lpszMenuName >> 16) {
|
---|
69 | menuName = (ULONG)malloc(strlen(wndclass->lpszMenuName)+1);
|
---|
70 | menuNameW = (ULONG)malloc((strlen(wndclass->lpszMenuName)+1)*sizeof(WCHAR));
|
---|
71 | if(menuName == NULL || menuNameW == NULL) {
|
---|
72 | dprintf(("Win32Class ctr; menuName/menuNameW == NULL"));
|
---|
73 | exit(1);
|
---|
74 | }
|
---|
75 | strcpy((char *)menuName, wndclass->lpszMenuName);
|
---|
76 | AsciiToUnicode(menuName, menuNameW);
|
---|
77 | }
|
---|
78 | else {
|
---|
79 | menuName = (ULONG)wndclass->lpszMenuName;
|
---|
80 | menuNameW = (ULONG)wndclass->lpszMenuName;
|
---|
81 | }
|
---|
82 |
|
---|
83 | windowStyle = wndclass->style;
|
---|
84 | windowProc = wndclass->lpfnWndProc;
|
---|
85 |
|
---|
86 | //User data class words/longs
|
---|
87 | if(nrExtraClassWords) {
|
---|
88 | userClassLong = (ULONG *)malloc(nrExtraClassWords);
|
---|
89 | if(userClassLong == NULL) {
|
---|
90 | dprintf(("Win32Class ctr: userClassLong == NULL!"));
|
---|
91 | exit(1);
|
---|
92 | }
|
---|
93 | memset(userClassLong, 0, nrExtraClassWords);
|
---|
94 | }
|
---|
95 | else userClassLong = NULL;
|
---|
96 |
|
---|
97 | hIconSm = wndclass->hIconSm;
|
---|
98 |
|
---|
99 | dprintf(("Win32WndClass::Win32WndClass %d\n", id));
|
---|
100 | }
|
---|
101 | //******************************************************************************
|
---|
102 | //******************************************************************************
|
---|
103 | Win32WndClass::~Win32WndClass()
|
---|
104 | {
|
---|
105 | Win32WndClass *wndclass = Win32WndClass::wndclasses;
|
---|
106 |
|
---|
107 | if(wndclass == this) {
|
---|
108 | wndclasses = next;
|
---|
109 | }
|
---|
110 | else {
|
---|
111 | while(wndclass->next != NULL) {
|
---|
112 | if(wndclass->next == this) {
|
---|
113 | wndclass->next = next;
|
---|
114 | break;
|
---|
115 | }
|
---|
116 | wndclass = wndclass->next;
|
---|
117 | }
|
---|
118 | }
|
---|
119 | if(userClassLong) free(userClassLong);
|
---|
120 | if(className) free(className);
|
---|
121 | if(classNameW) free(classNameW);
|
---|
122 | if(menuName && (ULONG)menuName >> 16) {
|
---|
123 | free(menuName)
|
---|
124 | assert(menuNameW);
|
---|
125 | free(menuNameW);
|
---|
126 | }
|
---|
127 | }
|
---|
128 | //******************************************************************************
|
---|
129 | //******************************************************************************
|
---|
130 | Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPSTR id)
|
---|
131 | {
|
---|
132 | Win32WndClass *wndclass = wndclasses;
|
---|
133 |
|
---|
134 | if(wndclass == NULL) return(NULL);
|
---|
135 |
|
---|
136 | if((ULONG)id >> 16 != 0) {
|
---|
137 | if(stricmp(wndclass->className, id) == 0 && wndclass->hInstance == hInstance) {
|
---|
138 | return(wndclass);
|
---|
139 | }
|
---|
140 | else {
|
---|
141 | wndclass = wndclass->next;
|
---|
142 | while(wndclass != NULL) {
|
---|
143 | if(stricmp(wndclass->className, id) == 0 && wndclass->hInstance == hInstance) {
|
---|
144 | return(wndclass);
|
---|
145 | }
|
---|
146 | wndclass = wndclass->next;
|
---|
147 | }
|
---|
148 | }
|
---|
149 | }
|
---|
150 | else {
|
---|
151 | if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {
|
---|
152 | return(wndclass);
|
---|
153 | }
|
---|
154 | else {
|
---|
155 | wndclass = wndclass->next;
|
---|
156 | while(wndclass != NULL) {
|
---|
157 | if(wndclass->classAtom == (DWORD)id && wndclass->hInstance == hInstance) {
|
---|
158 | return(wndclass);
|
---|
159 | }
|
---|
160 | wndclass = wndclass->next;
|
---|
161 | }
|
---|
162 | }
|
---|
163 | }
|
---|
164 | dprintf(("Class %X (inst %X) not found!", id, hInstance);
|
---|
165 | return(NULL);
|
---|
166 | }
|
---|
167 | //******************************************************************************
|
---|
168 | //******************************************************************************
|
---|
169 | BOOL Win32WndClass::getClassInfo(WNDCLASSEXA *wndclass)
|
---|
170 | {
|
---|
171 | wndclass->cbClsExtra = nrExtraClassWords;
|
---|
172 | wndclass->cbWndExtra = nrExtraWindowWords;
|
---|
173 | wndclass->hbrBackGround = backgroundBrush;
|
---|
174 | wndclass->hCursor = hCursor;
|
---|
175 | wndclass->hIcon = hIcon;
|
---|
176 | wndclass->hInstance = hInstance;
|
---|
177 | wndclass->lpszMenuName = (LPCTSTR)menuName;
|
---|
178 | wndclass->lpszClassName = (className) ? (LPCTSTR)className : (LPCTSTR)classAtom;
|
---|
179 | wndclass->style = windowStyle;
|
---|
180 | wndclass->lpfnWndProc = windowProc;
|
---|
181 | wndclass->hIconSm = hIconSm;
|
---|
182 | return(TRUE);
|
---|
183 | }
|
---|
184 | //******************************************************************************
|
---|
185 | //******************************************************************************
|
---|
186 | BOOL Win32WndClass::getClassInfo(WNDCLASSEXW *wndclass)
|
---|
187 | {
|
---|
188 | wndclass->cbClsExtra = nrExtraClassWords;
|
---|
189 | wndclass->cbWndExtra = nrExtraWindowWords;
|
---|
190 | wndclass->hbrBackGround = backgroundBrush;
|
---|
191 | wndclass->hCursor = hCursor;
|
---|
192 | wndclass->hIcon = hIcon;
|
---|
193 | wndclass->hInstance = hInstance;
|
---|
194 | wndclass->lpszMenuName = (LPCWSTR)menuNameW;
|
---|
195 | wndclass->lpszClassName = (classNameW) ? (LPCWSTR)classNameW : (LPCWSTR)classAtom;
|
---|
196 | wndclass->style = windowStyle;
|
---|
197 | wndclass->lpfnWndProc = windowProc;
|
---|
198 | wndclass->hIconSm = hIconSm;
|
---|
199 | return(TRUE);
|
---|
200 | }
|
---|
201 | //******************************************************************************
|
---|
202 | //******************************************************************************
|
---|
203 | ULONG Win32WndClass::getClassName(LPSTR lpszClassName, ULONG cchClassName)
|
---|
204 | {
|
---|
205 | if((ULONG)className >> 16 != 0) {
|
---|
206 | strncpy(lpszClassName, className, cchClassName-1);
|
---|
207 | return strlen(lpszClassName);
|
---|
208 | }
|
---|
209 | *(ULONG *)lpszClassName = classAtom;
|
---|
210 | return(sizeof(ULONG));
|
---|
211 | }
|
---|
212 | //******************************************************************************
|
---|
213 | //******************************************************************************
|
---|
214 | ULONG Win32WndClass::getClassName(LPWSTR lpszClassName, ULONG cchClassName)
|
---|
215 | {
|
---|
216 | ULONG len;
|
---|
217 |
|
---|
218 | if((ULONG)classNameW >> 16 != 0) {
|
---|
219 | len = min(UniStrLen((UniChar*)classNameW)+1, cchClassName);
|
---|
220 | memcpy(lpszClassName, classNameW, len*sizeof(WCHAR));
|
---|
221 | return len;
|
---|
222 | }
|
---|
223 | *(ULONG *)lpszClassName = classAtom;
|
---|
224 | return(sizeof(ULONG));
|
---|
225 | }
|
---|
226 | //******************************************************************************
|
---|
227 | //******************************************************************************
|
---|
228 | ULONG Win32WndClass::getClassLongA(int index, BOOL isUnicode)
|
---|
229 | {
|
---|
230 | switch(index) {
|
---|
231 | case GCL_CBCLSEXTRA:
|
---|
232 | return nrExtraClassWords;
|
---|
233 | case GCL_CBWNDEXTRA:
|
---|
234 | return nrExtraWindowWords;
|
---|
235 | case GCL_HBRBACKGROUND:
|
---|
236 | return backgroundBrush;
|
---|
237 | case GCL_HCURSOR:
|
---|
238 | return hCursor;
|
---|
239 | case GCL_HICON:
|
---|
240 | return hIcon;
|
---|
241 | case GCL_HMODULE:
|
---|
242 | return hInstance;
|
---|
243 | case GCL_MENUNAME:
|
---|
244 | return (isUnicode) ? menuNameW : menuName;
|
---|
245 | case GCL_STYLE:
|
---|
246 | return windowStyle;
|
---|
247 | case GCL_WNDPROC:
|
---|
248 | return windowProc;
|
---|
249 | case GCW_ATOM: //TODO: does this really happen in windows?
|
---|
250 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
251 | return 0;
|
---|
252 | default:
|
---|
253 | if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {
|
---|
254 | return userClassLong[index];
|
---|
255 | }
|
---|
256 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
257 | return 0;
|
---|
258 | }
|
---|
259 | }
|
---|
260 | //******************************************************************************
|
---|
261 | //******************************************************************************
|
---|
262 | WORD Win32WndClass::getClassWord(int index);
|
---|
263 | {
|
---|
264 | switch(index) {
|
---|
265 | case GCW_ATOM:
|
---|
266 | return (WORD)classAtom;
|
---|
267 | default:
|
---|
268 | if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {
|
---|
269 | return ((WORD *)userClassLong)[index];
|
---|
270 | }
|
---|
271 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
272 | return 0;
|
---|
273 | }
|
---|
274 | }
|
---|
275 | //******************************************************************************
|
---|
276 | //TODO: What effects what immediately?
|
---|
277 | //******************************************************************************
|
---|
278 | ULONG Win32WndClass::setClassLong(int index, LONG lNewVal, BOOL isUnicode);
|
---|
279 | {
|
---|
280 | ULONG rc;
|
---|
281 |
|
---|
282 | switch(index) {
|
---|
283 | case GCL_CBCLSEXTRA: //TODO (doesn't affect allocated classes, so what does it do?)
|
---|
284 | rc = nrExtraClassWords;
|
---|
285 | // nrExtraClassWords = lNewVal;
|
---|
286 | break;
|
---|
287 | case GCL_CBWNDEXTRA:
|
---|
288 | rc = nrExtraWindowWords;
|
---|
289 | nrExtraWindowWords = lNewVal;
|
---|
290 | break;
|
---|
291 | case GCL_HBRBACKGROUND:
|
---|
292 | rc = backgroundBrush;
|
---|
293 | backgroundBrush = lNewVal;
|
---|
294 | break;
|
---|
295 | case GCL_HCURSOR:
|
---|
296 | rc = hCursor;
|
---|
297 | hCursor = lNewVal;
|
---|
298 | break;
|
---|
299 | case GCL_HICON:
|
---|
300 | rc = hIcon;
|
---|
301 | hIcon = lNewVal;
|
---|
302 | break;
|
---|
303 | case GCL_HMODULE:
|
---|
304 | rc = hInstance;
|
---|
305 | hInstance = lNewVal;
|
---|
306 | break;
|
---|
307 | case GCL_MENUNAME:
|
---|
308 | if(isUnicode) {
|
---|
309 | rc = menuNameW;
|
---|
310 | menuNameW = lNewVal; //FIXME
|
---|
311 | }
|
---|
312 | else {
|
---|
313 | rc = menuName;
|
---|
314 | menuName = lNewVal; //FIXME
|
---|
315 | }
|
---|
316 | break;
|
---|
317 | case GCL_STYLE:
|
---|
318 | rc = windowStyle;
|
---|
319 | windowStyle = lNewVal;
|
---|
320 | break;
|
---|
321 | case GCL_WNDPROC:
|
---|
322 | rc = windowProc;
|
---|
323 | windowProc = lNewVal;
|
---|
324 | break;
|
---|
325 | case GCW_ATOM: //TODO: does this really happen in windows?
|
---|
326 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
327 | return 0;
|
---|
328 | default:
|
---|
329 | if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {
|
---|
330 | rc = userClassLong[index];
|
---|
331 | userClassLong[index] = lNewVal;
|
---|
332 | return(rc);
|
---|
333 | }
|
---|
334 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
335 | return 0;
|
---|
336 | }
|
---|
337 | return(rc);
|
---|
338 | }
|
---|
339 | //******************************************************************************
|
---|
340 | //******************************************************************************
|
---|
341 | WORD Win32WndClass::setClassWord(int index, WORD wNewVal);
|
---|
342 | {
|
---|
343 | WORD rc;
|
---|
344 |
|
---|
345 | switch(index) {
|
---|
346 | case GCW_ATOM:
|
---|
347 | rc = (WORD)classAtom;
|
---|
348 | classAtom = wNewVal;
|
---|
349 | return(rc);
|
---|
350 | default:
|
---|
351 | if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) {
|
---|
352 | rc = ((WORD *)userClassLong)[index];
|
---|
353 | ((WORD *)userClassLong)[index] = wNewVal;
|
---|
354 | return(rc);
|
---|
355 | }
|
---|
356 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
357 | return 0;
|
---|
358 | }
|
---|
359 | }
|
---|
360 | //******************************************************************************
|
---|
361 | //FIXME: Windows that still exists with this class
|
---|
362 | //******************************************************************************
|
---|
363 | void Win32WndClass::UnregisterClassA(HINSTANCE hinst, LPSTR id)
|
---|
364 | {
|
---|
365 | Win32WndClass *wndclass;
|
---|
366 |
|
---|
367 | dprintf(("::UnregisterClass, destroy class %X!!\n", id));
|
---|
368 | wndclass = FindClass(hinst, id);
|
---|
369 | if(wndclass) {
|
---|
370 | delete wndclass;
|
---|
371 | return;
|
---|
372 | }
|
---|
373 | dprintf(("::UnregisterClass, couldn't find class %X!!\n", id));
|
---|
374 | }
|
---|
375 | //******************************************************************************
|
---|
376 | //******************************************************************************
|
---|
377 | Win32WndClass *Win32WndClass::wndclasses = NULL;
|
---|
378 |
|
---|
379 | //******************************************************************************
|
---|
380 | //SvL: 18-7-'98: Moved here from user32.cpp
|
---|
381 | //******************************************************************************
|
---|
382 | ATOM WIN32API OS2RegisterClassA(WNDCLASS *lpWndClass)
|
---|
383 | {
|
---|
384 | WNDCLASSEXA wc;
|
---|
385 | Win32Class *wclass;
|
---|
386 |
|
---|
387 | memcpy(&wc, lpWndClass, sizeof(WNDCLASS));
|
---|
388 | wc.hIconSm = 0;
|
---|
389 |
|
---|
390 | wclass = new Win32Class(&wc);
|
---|
391 | if(wclass == NULL) {
|
---|
392 | dprintf(("RegisterClassA wclass == NULL!"));
|
---|
393 | return(0);
|
---|
394 | }
|
---|
395 | return(wclass->getAtom());
|
---|
396 | }
|
---|
397 | //******************************************************************************
|
---|
398 | //SvL: 18-7-'98: Moved here from user32.cpp
|
---|
399 | //******************************************************************************
|
---|
400 | ATOM WIN32API OS2RegisterClassExA(WNDCLASSEXA *lpWndClass)
|
---|
401 | {
|
---|
402 | Win32Class *wclass;
|
---|
403 |
|
---|
404 | wclass = new Win32Class(lpWndClass);
|
---|
405 | if(wclass == NULL) {
|
---|
406 | dprintf(("RegisterClassExA wclass == NULL!"));
|
---|
407 | return(0);
|
---|
408 | }
|
---|
409 | return(wclass->getAtom());
|
---|
410 | }
|
---|
411 | //******************************************************************************
|
---|
412 | //******************************************************************************
|
---|
413 | WORD WIN32API OS2RegisterClassW(WNDCLASSW *lpwc)
|
---|
414 | {
|
---|
415 | ATOM rc;
|
---|
416 | WNDCLASSEX wclass;
|
---|
417 |
|
---|
418 | dprintf(("RegisterClassW\n"));
|
---|
419 | memcpy(&wclass, lpwc, sizeof(WNDCLASS));
|
---|
420 | if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
|
---|
421 | wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
|
---|
422 | }
|
---|
423 | if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
|
---|
424 | wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
|
---|
425 | }
|
---|
426 | rc = OS2RegisterClassA(&wclass);
|
---|
427 |
|
---|
428 | if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
|
---|
429 | FreeAsciiString((char *)wclass.lpszMenuName);
|
---|
430 | }
|
---|
431 | if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
|
---|
432 | FreeAsciiString((char *)wclass.lpszClassName);
|
---|
433 | }
|
---|
434 | return(rc);
|
---|
435 | }
|
---|
436 | //******************************************************************************
|
---|
437 | //******************************************************************************
|
---|
438 | ATOM WIN32API OS2RegisterClassExW(CONST WNDCLASSEXW *lpwc)
|
---|
439 | {
|
---|
440 | ATOM rc;
|
---|
441 | WNDCLASSEXA wclass;
|
---|
442 |
|
---|
443 | dprintf(("RegisterClassExW\n"));
|
---|
444 | memcpy(&wclass, lpwc, sizeof(WNDCLASSEXA));
|
---|
445 | if(wclass.lpszMenuName && ((ULONG)wclass.lpszMenuName >> 16 != 0)) {
|
---|
446 | wclass.lpszMenuName = UnicodeToAsciiString((LPWSTR)lpwc->lpszMenuName);
|
---|
447 | }
|
---|
448 | if(wclass.lpszClassName && ((ULONG)wclass.lpszClassName >> 16 != 0)) {
|
---|
449 | wclass.lpszClassName = UnicodeToAsciiString((LPWSTR)lpwc->lpszClassName);
|
---|
450 | }
|
---|
451 | rc = OS2RegisterClassExA(&wclass);
|
---|
452 |
|
---|
453 | if(lpwc->lpszMenuName && ((ULONG)lpwc->lpszMenuName >> 16 != 0)) {
|
---|
454 | FreeAsciiString((char *)wclass.lpszMenuName);
|
---|
455 | }
|
---|
456 | if(lpwc->lpszClassName && ((ULONG)lpwc->lpszClassName >> 16 != 0)) {
|
---|
457 | FreeAsciiString((char *)wclass.lpszClassName);
|
---|
458 | }
|
---|
459 | return(rc);
|
---|
460 | }
|
---|
461 | //******************************************************************************
|
---|
462 | //******************************************************************************
|
---|
463 | BOOL WIN32API OS2UnregisterClassA(LPCSTR lpszClassName, HINSTANCE hinst)
|
---|
464 | {
|
---|
465 | dprintf(("USER32: OS2UnregisterClassA\n"));
|
---|
466 | Win32WndClass::UnregisterClass(hinst, (LPSTR)lpszClassName);
|
---|
467 |
|
---|
468 | //Spintest returns FALSE in dll termination, so pretend it succeeded
|
---|
469 | return(TRUE);
|
---|
470 | }
|
---|
471 | //******************************************************************************
|
---|
472 | //******************************************************************************
|
---|
473 | BOOL WIN32API OS2UnregisterClassW(LPWSTR lpszClassName, HINSTANCE hinst)
|
---|
474 | {
|
---|
475 | char *astring = NULL;
|
---|
476 |
|
---|
477 | dprintf(("USER32: OS2UnregisterClassW\n"));
|
---|
478 | if((ULONG)lpszClassName >> 16 != 0) {
|
---|
479 | astring = UnicodeToAsciiString(lpszClassName);
|
---|
480 | }
|
---|
481 | else astring = (char *)lpszClassName;
|
---|
482 |
|
---|
483 | Win32WndClass::UnregisterClass(hinst, (LPSTR)astring);
|
---|
484 | if(astring >> 16 != 0)
|
---|
485 | FreeAsciiString((char *)astring);
|
---|
486 | //Spintest returns FALSE in dll termination, so pretend it succeeded
|
---|
487 | return(TRUE);
|
---|
488 | }
|
---|
489 | //******************************************************************************
|
---|
490 | //******************************************************************************
|
---|
491 | BOOL WIN32API OS2GetClassInfoA(HINSTANCE hInstance, LPCSTR lpszClass, PWNDCLASSA lpwc)
|
---|
492 | {
|
---|
493 | WNDCLASSEXA wc;
|
---|
494 | BOOL rc;
|
---|
495 | Win32WndClass *wndclass;
|
---|
496 |
|
---|
497 | dprintf(("USER32: OS2GetClassInfoA\n"));
|
---|
498 |
|
---|
499 | wndclass = FindClass(hInstance, lpszClass);
|
---|
500 | if(wndclass) {
|
---|
501 | wndclass->getClassInfo(&wc);
|
---|
502 | memcpy(lpwc, &wc, sizeof(WNDCLASSA));
|
---|
503 | return(TRUE);
|
---|
504 | }
|
---|
505 | return(FALSE);
|
---|
506 | }
|
---|
507 | //******************************************************************************
|
---|
508 | //******************************************************************************
|
---|
509 | BOOL WIN32API OS2GetClassInfoW(HINSTANCE hinst, LPWSTR lpszClass, PWNDCLASSW lpwc)
|
---|
510 | {
|
---|
511 | WNDCLASSEXW wc;
|
---|
512 | BOOL rc;
|
---|
513 | Win32WndClass *wndclass;
|
---|
514 | char *astring = NULL;
|
---|
515 |
|
---|
516 | dprintf(("USER32: OS2GetClassInfoW\n"));
|
---|
517 |
|
---|
518 | if((ULONG)lpszClass >> 16 != 0) {
|
---|
519 | astring = UnicodeToAsciiString(lpszClass);
|
---|
520 | }
|
---|
521 | else astring = (char *)lpszClass;
|
---|
522 |
|
---|
523 | wndclass = FindClass(hInstance, astring);
|
---|
524 | if((ULONG)astring >> 16 != 0)
|
---|
525 | FreeAsciiString((char *)astring);
|
---|
526 | if(wndclass) {
|
---|
527 | wndclass->getClassInfo(&wc);
|
---|
528 | memcpy(lpwc, &wc, sizeof(WNDCLASSW));
|
---|
529 | return(TRUE);
|
---|
530 | }
|
---|
531 | return(FALSE);
|
---|
532 | }
|
---|
533 | /****************************************************************************
|
---|
534 | * Name : BOOL WIN32API OS2GetClassInfoExA
|
---|
535 | * Purpose : The GetClassInfoEx function retrieves information about a window
|
---|
536 | * class, including the handle of the small icon associated with the
|
---|
537 | * window class. GetClassInfo does not retrieve the handle of the small icon.
|
---|
538 | * Parameters: HINSTANCE hinst handle of application instance
|
---|
539 | * LPCTSTR lpszClass address of class name string
|
---|
540 | * LPWNDCLASSEX lpwcx address of structure for class data
|
---|
541 | * Variables :
|
---|
542 | * Result : If the function finds a matching class and successfully copies
|
---|
543 | * the data, the return value is TRUE;
|
---|
544 | * otherwise, it is FALSE.
|
---|
545 | * To get extended error information, call GetLastError.
|
---|
546 | * Remark : PH: does not obtain handle of the small icon
|
---|
547 | *****************************************************************************/
|
---|
548 | BOOL WIN32API OS2GetClassInfoExA(HINSTANCE hInstance,
|
---|
549 | LPCTSTR lpszClass,
|
---|
550 | LPWNDCLASSEXA lpwcx)
|
---|
551 | {
|
---|
552 | BOOL rc;
|
---|
553 | Win32WndClass *wndclass;
|
---|
554 |
|
---|
555 | dprintf(("USER32:GetClassInfoExA (%08xh,%x,%08x).\n",
|
---|
556 | hInstance,
|
---|
557 | lpszClass,
|
---|
558 | lpwcx));
|
---|
559 |
|
---|
560 | wndclass = FindClass(hInstance, lpszClass);
|
---|
561 | if(wndclass) {
|
---|
562 | wndclass->getClassInfo(lpwcx);
|
---|
563 | return(TRUE);
|
---|
564 | }
|
---|
565 | return(FALSE);
|
---|
566 | }
|
---|
567 | /*****************************************************************************
|
---|
568 | * Name : BOOL WIN32API OS2GetClassInfoExW
|
---|
569 | * Purpose : The GetClassInfoEx function retrieves information about a window
|
---|
570 | * class, including the handle of the small icon associated with the
|
---|
571 | * window class. GetClassInfo does not retrieve the handle of the small icon.
|
---|
572 | * Parameters: HINSTANCE hinst handle of application instance
|
---|
573 | * LPCWSTR lpszClass address of class name string
|
---|
574 | * LPWNDCLASSEX lpwcx address of structure for class data
|
---|
575 | * Variables :
|
---|
576 | * Result : If the function finds a matching class and successfully copies
|
---|
577 | * the data, the return value is TRUE;
|
---|
578 | * otherwise, it is FALSE.
|
---|
579 | * To get extended error information, call GetLastError.
|
---|
580 | * Remark : does not obtain handle of the small icon
|
---|
581 | *
|
---|
582 | *****************************************************************************/
|
---|
583 | BOOL WIN32API OS2GetClassInfoExW(HINSTANCE hInstance,
|
---|
584 | LPCWSTR lpszClass,
|
---|
585 | LPWNDCLASSEXW lpwcx)
|
---|
586 | {
|
---|
587 | BOOL rc;
|
---|
588 | Win32WndClass *wndclass;
|
---|
589 | char *astring = NULL;
|
---|
590 |
|
---|
591 | dprintf(("USER32: OS2GetClassInfoExW\n"));
|
---|
592 |
|
---|
593 | if((ULONG)lpszClass >> 16 != 0) {
|
---|
594 | astring = UnicodeToAsciiString(lpszClass);
|
---|
595 | }
|
---|
596 | else astring = (char *)lpszClass;
|
---|
597 |
|
---|
598 | wndclass = FindClass(hInstance, astring);
|
---|
599 | if((ULONG)astring >> 16 != 0)
|
---|
600 | FreeAsciiString((char *)astring);
|
---|
601 | if(wndclass) {
|
---|
602 | wndclass->getClassInfo(lpwcx);
|
---|
603 | return(TRUE);
|
---|
604 | }
|
---|
605 | return(FALSE);
|
---|
606 | }
|
---|
607 | //******************************************************************************
|
---|
608 | //******************************************************************************
|
---|
609 | int WIN32API OS2GetClassNameA(HWND hwnd, LPSTR lpszClassName, int cchClassName)
|
---|
610 | {
|
---|
611 | Win32Window *wnd;
|
---|
612 |
|
---|
613 | dprintf(("USER32: OS2GetClassNameA\n"));
|
---|
614 | wnd = WIN2OS2HWND(hwnd);
|
---|
615 | if(wnd == NULL) {
|
---|
616 | dprintf(("GetClassNameA wnd == NULL"));
|
---|
617 | return(0);
|
---|
618 | }
|
---|
619 | return (wnd->getClass())->getClassName(lpszClassName, cchClassName);
|
---|
620 | }
|
---|
621 | //******************************************************************************
|
---|
622 | //******************************************************************************
|
---|
623 | int WIN32API OS2GetClassNameW(HWND hwnd, LPWSTR lpszClassName, int cchClassName)
|
---|
624 | {
|
---|
625 | Win32Window *wnd;
|
---|
626 |
|
---|
627 | dprintf(("USER32: OS2GetClassNameW\n"));
|
---|
628 | wnd = WIN2OS2HWND(hwnd);
|
---|
629 | if(wnd == NULL) {
|
---|
630 | dprintf(("GetClassNameA wnd == NULL"));
|
---|
631 | return(0);
|
---|
632 | }
|
---|
633 | return (wnd->getClass())->getClassName(lpszClassName, cchClassName);
|
---|
634 | }
|
---|
635 | //******************************************************************************
|
---|
636 | //******************************************************************************
|
---|
637 | DWORD WIN32API OS2SetClassLongA(HWND hwnd, int nIndex, LONG lNewVal)
|
---|
638 | {
|
---|
639 | Win32Window *wnd;
|
---|
640 |
|
---|
641 | dprintf(("USER32: OS2SetClassLongA\n"));
|
---|
642 | wnd = WIN2OS2HWND(hwnd);
|
---|
643 | if(wnd == NULL) {
|
---|
644 | dprintf(("SetClassLongA wnd == NULL"));
|
---|
645 | return(0);
|
---|
646 | }
|
---|
647 | return (wnd->getClass())->setClassLongA(nIndex, lNewVal);
|
---|
648 | }
|
---|
649 | //******************************************************************************
|
---|
650 | //******************************************************************************
|
---|
651 | DWORD WIN32API OS2SetClassLongW(HWND hwnd, int nIndex, LONG lNewVal)
|
---|
652 | {
|
---|
653 | Win32Window *wnd;
|
---|
654 |
|
---|
655 | dprintf(("USER32: OS2SetClassLongW\n"));
|
---|
656 | wnd = WIN2OS2HWND(hwnd);
|
---|
657 | if(wnd == NULL) {
|
---|
658 | dprintf(("SetClassLongW wnd == NULL"));
|
---|
659 | return(0);
|
---|
660 | }
|
---|
661 | return (wnd->getClass())->setClassLongW(nIndex, lNewVal);
|
---|
662 | }
|
---|
663 | //******************************************************************************
|
---|
664 | //******************************************************************************
|
---|
665 | WORD WIN32API OS2SetClassWord(HWND hwnd, int nIndex, WORD wNewVal)
|
---|
666 | {
|
---|
667 | Win32Window *wnd;
|
---|
668 |
|
---|
669 | dprintf(("USER32: OS2SetClassWordA\n"));
|
---|
670 | wnd = WIN2OS2HWND(hwnd);
|
---|
671 | if(wnd == NULL) {
|
---|
672 | dprintf(("SetClassWordA wnd == NULL"));
|
---|
673 | return(0);
|
---|
674 | }
|
---|
675 | return (wnd->getClass())->setClassWord(nIndex, wNewVal);
|
---|
676 | }
|
---|
677 | //******************************************************************************
|
---|
678 | //******************************************************************************
|
---|
679 | WORD WIN32API OS2GetClassWord(HWND hwnd, int nIndex)
|
---|
680 | {
|
---|
681 | Win32Window *wnd;
|
---|
682 |
|
---|
683 | dprintf(("USER32: OS2GetClassWordA\n"));
|
---|
684 | wnd = WIN2OS2HWND(hwnd);
|
---|
685 | if(wnd == NULL) {
|
---|
686 | dprintf(("GetClassWordA wnd == NULL"));
|
---|
687 | return(0);
|
---|
688 | }
|
---|
689 | return (wnd->getClass())->getClassWord(nIndex);
|
---|
690 | }
|
---|
691 | //******************************************************************************
|
---|
692 | //******************************************************************************
|
---|
693 | DWORD WIN32API OS2GetClassLongA(HWND hwnd, int nIndex)
|
---|
694 | {
|
---|
695 | Win32Window *wnd;
|
---|
696 |
|
---|
697 | dprintf(("USER32: OS2GetClassLongA\n"));
|
---|
698 | wnd = WIN2OS2HWND(hwnd);
|
---|
699 | if(wnd == NULL) {
|
---|
700 | dprintf(("OS2GetClassLongA wnd == NULL"));
|
---|
701 | return(0);
|
---|
702 | }
|
---|
703 | return (wnd->getClass())->getClassLongA(nIndex);
|
---|
704 | }
|
---|
705 | //******************************************************************************
|
---|
706 | //******************************************************************************
|
---|
707 | DWORD WIN32API OS2GetClassLongW(HWND hwnd, int nIndex)
|
---|
708 | {
|
---|
709 | Win32Window *wnd;
|
---|
710 |
|
---|
711 | dprintf(("USER32: OS2GetClassLongW\n"));
|
---|
712 | wnd = WIN2OS2HWND(hwnd);
|
---|
713 | if(wnd == NULL) {
|
---|
714 | dprintf(("OS2GetClassLongW wnd == NULL"));
|
---|
715 | return(0);
|
---|
716 | }
|
---|
717 | return (wnd->getClass())->getClassLongW(nIndex);
|
---|
718 | }
|
---|
719 | //******************************************************************************
|
---|
720 | //******************************************************************************
|
---|