source: trunk/src/user32/window.cpp@ 5406

Last change on this file since 5406 was 5406, checked in by sandervl, 24 years ago

syscolor change + iconsm creation in RegisterClassA/W

File size: 65.9 KB
Line 
1/* $Id: window.cpp,v 1.91 2001-03-30 22:08:20 sandervl Exp $ */
2/*
3 * Win32 window apis for OS/2
4 *
5 * Copyright 1999-2001 Sander van Leeuwen (sandervl@xs4all.nl)
6 * Copyright 1999 Daniela Engert (dani@ngrt.de)
7 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
8 *
9 * Parts based on Wine Windows code (windows\win.c, windows\property.c, windows\winpos.c)
10 *
11 * Copyright 1993, 1994, 1995 Alexandre Julliard
12 * 1995, 1996, 1999 Alex Korobka
13 *
14 * Project Odin Software License can be found in LICENSE.TXT
15 *
16 *
17 * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps)
18 * TODO: ShowOwnedPopups needs to be tested
19 * GetLastActivePopup needs to be rewritten
20 * ArrangeIconicWindows probably too
21 *
22 */
23
24#include <os2win.h>
25#include <misc.h>
26#include <string.h>
27#include <stdio.h>
28#include <win32wbase.h>
29#include <win32wmdiclient.h>
30#include <win32wdesktop.h>
31#include "win32dlg.h"
32#include <oslibwin.h>
33#include <oslibgdi.h>
34#include "user32.h"
35#include "winicon.h"
36#include "oslibmsg.h"
37#include <win\winpos.h>
38#include <win\win.h>
39#include <heapstring.h>
40#include <winuser32.h>
41
42#define DBG_LOCALLOG DBG_window
43#include "dbglocal.h"
44
45//******************************************************************************
46//******************************************************************************
47HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
48 LPCSTR windowName, DWORD style, INT x,
49 INT y, INT width, INT height,
50 HWND parent, HMENU menu,
51 HINSTANCE instance, LPVOID data )
52{
53 Win32BaseWindow *window;
54 ATOM classAtom;
55 CREATESTRUCTA cs;
56 char tmpClass[20];
57
58 if(exStyle & WS_EX_MDICHILD)
59 return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
60
61 /* Find the class atom */
62 if (!(classAtom = GlobalFindAtomA(className)))
63 {
64 if (!HIWORD(className))
65 dprintf(("CreateWindowEx32A: bad class name %04x\n",LOWORD(className)));
66 else
67 dprintf(("CreateWindowEx32A: bad class name '%s'\n", className));
68
69 SetLastError(ERROR_INVALID_PARAMETER);
70 return 0;
71 }
72
73 if (!HIWORD(className))
74 {
75 sprintf(tmpClass,"#%d", (int) className);
76 className = tmpClass;
77 }
78
79 /* Create the window */
80 cs.lpCreateParams = data;
81 cs.hInstance = instance;
82 cs.hMenu = menu;
83 cs.hwndParent = parent;
84 cs.x = x;
85 cs.y = y;
86 cs.cx = width;
87 cs.cy = height;
88 cs.style = style;
89 cs.lpszName = windowName;
90 cs.lpszClass = className;
91 cs.dwExStyle = exStyle;
92 if(HIWORD(className)) {
93 dprintf(("CreateWindowExA: class %s parent %x (%d,%d) (%d,%d), %x %x menu=%x", className, parent, x, y, width, height, style, exStyle, menu));
94 }
95 else dprintf(("CreateWindowExA: class %d parent %x (%d,%d) (%d,%d), %x %x menu=%x", className, parent, x, y, width, height, style, exStyle, menu));
96
97 if(!strcmpi(className, MDICLIENTCLASSNAMEA)) {
98 window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, FALSE);
99 }
100 else
101 if(!strcmpi((char *) className, DIALOG_CLASS_NAMEA))
102 {
103 DLG_TEMPLATE dlgTemplate = {0};
104 dlgTemplate.style = cs.style;
105 dlgTemplate.exStyle = cs.dwExStyle;
106 dlgTemplate.x = cs.x;
107 dlgTemplate.y = cs.y;
108 dlgTemplate.cx = cs.cx;
109 dlgTemplate.cy = cs.cy;
110 dlgTemplate.className = cs.lpszClass;
111 dlgTemplate.caption = cs.lpszName;
112 window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
113 (LPCSTR) &dlgTemplate,
114 cs.hwndParent,
115 NULL,
116 (LPARAM) data,
117 FALSE);
118 }
119 else {
120 window = new Win32BaseWindow( &cs, classAtom, FALSE );
121 }
122 if(window == NULL)
123 {
124 dprintf(("Win32BaseWindow creation failed!!"));
125 return 0;
126 }
127 if(GetLastError() != 0)
128 {
129 dprintf(("Win32BaseWindow error found!!"));
130 delete window;
131 return 0;
132 }
133 return window->getWindowHandle();
134}
135//******************************************************************************
136//******************************************************************************
137HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
138 LPCWSTR windowName, DWORD style, INT x,
139 INT y, INT width, INT height,
140 HWND parent, HMENU menu,
141 HINSTANCE instance, LPVOID data )
142{
143 Win32BaseWindow *window;
144 ATOM classAtom;
145 CREATESTRUCTA cs;
146 WCHAR tmpClassW[20];
147
148 if(exStyle & WS_EX_MDICHILD)
149 return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
150
151 /* Find the class atom */
152 if (!(classAtom = GlobalFindAtomW(className)))
153 {
154 if (!HIWORD(className))
155 dprintf(("CreateWindowEx32W: bad class name %04x",LOWORD(className)));
156 else
157 dprintf(("CreateWindowEx32W: bad class name '%ls'", className));
158
159 SetLastError(ERROR_INVALID_PARAMETER);
160 return 0;
161 }
162
163 if(HIWORD(className)) {
164 dprintf(("CreateWindowExW: class %ls name %x parent %x (%d,%d) (%d,%d), %x %x", className, windowName, parent, x, y, width, height, style, exStyle));
165 }
166 else dprintf(("CreateWindowExW: class %d name %x parent %x (%d,%d) (%d,%d), %x %x", className, windowName, parent, x, y, width, height, style, exStyle));
167
168 if (!HIWORD(className))
169 {
170 wsprintfW(tmpClassW, (LPCWSTR)L"#%d", (int) className);
171 className = tmpClassW;
172 }
173
174 /* Create the window */
175 cs.lpCreateParams = data;
176 cs.hInstance = instance;
177 cs.hMenu = menu;
178 cs.hwndParent = parent;
179 cs.x = x;
180 cs.y = y;
181 cs.cx = width;
182 cs.cy = height;
183 cs.style = style;
184 cs.lpszName = (LPSTR)windowName;
185 cs.lpszClass = (LPSTR)className;
186 cs.dwExStyle = exStyle;
187
188 if(!lstrcmpiW(className, (LPWSTR)MDICLIENTCLASSNAMEW)) {
189 window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, TRUE);
190 }
191 else
192 if(!lstrcmpiW(className, (LPWSTR)DIALOG_CLASS_NAMEW))
193 {
194 DLG_TEMPLATE dlgTemplate = {0};
195 dlgTemplate.style = cs.style;
196 dlgTemplate.exStyle = cs.dwExStyle;
197 dlgTemplate.x = cs.x;
198 dlgTemplate.y = cs.y;
199 dlgTemplate.cx = cs.cx;
200 dlgTemplate.cy = cs.cy;
201 dlgTemplate.className = cs.lpszClass;
202 dlgTemplate.caption = cs.lpszName;
203 window = (Win32BaseWindow *) new Win32Dialog(cs.hInstance,
204 (LPCSTR) &dlgTemplate,
205 cs.hwndParent,
206 NULL,
207 (LPARAM) data,
208 TRUE);
209 }
210 else {
211 window = new Win32BaseWindow( &cs, classAtom, TRUE );
212 }
213 if(window == NULL)
214 {
215 dprintf(("Win32BaseWindow creation failed!!"));
216 return 0;
217 }
218 if(GetLastError() != 0)
219 {
220 dprintf(("Win32BaseWindow error found!!"));
221 delete window;
222 return 0;
223 }
224 return window->getWindowHandle();
225}
226//******************************************************************************
227//******************************************************************************
228HWND WIN32API CreateFakeWindowEx(HWND hwndOS2)
229{
230 Win32BaseWindow *window;
231
232 window = new Win32BaseWindow(hwndOS2, 0);
233 if(window == NULL)
234 {
235 dprintf(("Win32BaseWindow creation failed!!"));
236 return 0;
237 }
238 return window->getWindowHandle();
239}
240//******************************************************************************
241//******************************************************************************
242HWND WIN32API CreateMDIWindowA(LPCSTR lpszClassName, LPCSTR lpszWindowName,
243 DWORD dwStyle, int x, int y, int nWidth,
244 int nHeight, HWND hwndParent,
245 HINSTANCE hInstance, LPARAM lParam )
246{
247 HWND hwnd;
248 MDICREATESTRUCTA cs;
249 Win32BaseWindow *window;
250
251 window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
252 if(!window) {
253 dprintf(("CreateMDIWindowA, window %x not found", hwndParent));
254 return 0;
255 }
256
257 cs.szClass = lpszClassName;
258 cs.szTitle = lpszWindowName;
259 cs.hOwner = hInstance;
260 cs.x = x;
261 cs.y = y;
262 cs.cx = nHeight;
263 cs.cy = nWidth;
264 cs.style = dwStyle;
265 cs.lParam = lParam;
266
267 if(HIWORD(lpszClassName)) {
268 dprintf(("CreateMDIWindowA: class %s parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam));
269 }
270 else dprintf(("CreateMDIWindowA: class %d parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam));
271
272 return window->SendMessageA(WM_MDICREATE, 0, (LPARAM)&cs);
273}
274//******************************************************************************
275//******************************************************************************
276HWND WIN32API CreateMDIWindowW(LPCWSTR lpszClassName, LPCWSTR lpszWindowName,
277 DWORD dwStyle, int x, int y, int nWidth,
278 int nHeight, HWND hwndParent,
279 HINSTANCE hInstance, LPARAM lParam )
280{
281 HWND hwnd;
282 MDICREATESTRUCTW cs;
283 Win32BaseWindow *window;
284
285 window = Win32BaseWindow::GetWindowFromHandle(hwndParent);
286 if(!window) {
287 dprintf(("CreateMDIWindowW, window %x not found", hwndParent));
288 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
289 return 0;
290 }
291
292 cs.szClass = lpszClassName;
293 cs.szTitle = lpszWindowName;
294 cs.hOwner = hInstance;
295 cs.x = x;
296 cs.y = y;
297 cs.cx = nHeight;
298 cs.cy = nWidth;
299 cs.style = dwStyle;
300 cs.lParam = lParam;
301
302 if(HIWORD(lpszClassName)) {
303 dprintf(("CreateMDIWindowW: class %ls parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam));
304 }
305 else dprintf(("CreateMDIWindowW: class %d parent %x (%d,%d) (%d,%d), %x %x lParam=%x", lpszClassName, hwndParent, x, y, nWidth, nHeight, dwStyle, lParam));
306
307 return window->SendMessageW(WM_MDICREATE, 0, (LPARAM)&cs);
308}
309//******************************************************************************
310//******************************************************************************
311BOOL WIN32API DestroyWindow(HWND hwnd)
312{
313 Win32BaseWindow *window;
314
315 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
316 if(!window) {
317 dprintf(("DestroyWindow, window %x not found", hwnd));
318 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
319 return 0;
320 }
321 if(window->isDesktopWindow()) {
322 dprintf(("WARNING: Trying to destroy desktop window!"));
323 return FALSE;
324 }
325 return window->DestroyWindow();
326}
327//******************************************************************************
328//******************************************************************************
329HWND WIN32API SetActiveWindow( HWND hwnd)
330{
331 Win32BaseWindow *window;
332
333 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
334 if(!window) {
335 dprintf(("SetActiveWindow, window %x not found", hwnd));
336 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
337 return 0;
338 }
339 return window->SetActiveWindow();
340}
341//******************************************************************************
342//Note: does not set last error if no parent (verified in NT4, SP6)
343//******************************************************************************
344HWND WIN32API GetParent( HWND hwnd)
345{
346 Win32BaseWindow *window;
347
348 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
349 if(!window) {
350 dprintf(("GetParent, window %x not found", hwnd));
351 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
352 return 0;
353 }
354 dprintf2(("GetParent %x", hwnd));
355 return window->GetParent();
356}
357//******************************************************************************
358//******************************************************************************
359HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
360{
361 Win32BaseWindow *window, *parent;
362
363 window = Win32BaseWindow::GetWindowFromHandle(hwndChild);
364 if(!window) {
365 dprintf(("SetParent, window %x not found", hwndChild));
366 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
367 return 0;
368 }
369 if(hwndNewParent == HWND_DESKTOP) {
370 hwndNewParent = GetDesktopWindow();
371 }
372 else {
373 parent = Win32BaseWindow::GetWindowFromHandle(hwndNewParent);
374 if(!window) {
375 dprintf(("SetParent, parent %x not found", hwndNewParent));
376 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
377 return 0;
378 }
379 }
380 dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
381 return window->SetParent(hwndNewParent);
382}
383//******************************************************************************
384//******************************************************************************
385BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
386{
387 Win32BaseWindow *window;
388
389 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
390 if(!window) {
391 dprintf(("IsChild %x, window %x not found", hwndParent, hwnd));
392 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
393 return 0;
394 }
395 dprintf(("IsChild %x %x", hwndParent, hwnd));
396 return window->IsChild(hwndParent);
397}
398//******************************************************************************
399//******************************************************************************
400HWND WIN32API GetTopWindow( HWND hwnd)
401{
402 Win32BaseWindow *window;
403 HWND hwndTop;
404
405 if(hwnd == HWND_DESKTOP) {
406 window = windowDesktop;
407 }
408 else {
409 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
410 if(!window) {
411 dprintf(("GetTopWindow, window %x not found", hwnd));
412 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
413 return 0;
414 }
415 }
416 hwndTop = window->GetTopWindow();
417 dprintf2(("GetTopWindow %x returned %x", hwnd, hwndTop));
418 return hwndTop;
419}
420//******************************************************************************
421//******************************************************************************
422BOOL WIN32API IsIconic( HWND hwnd)
423{
424 Win32BaseWindow *window;
425 BOOL rc;
426
427 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
428 if(!window) {
429 dprintf(("IsIconic, window %x not found", hwnd));
430 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
431 return FALSE;
432 }
433 rc = window->IsWindowIconic();
434 dprintf(("IsIconic %x returned %d", hwnd, rc));
435 return rc;
436}
437//******************************************************************************
438//******************************************************************************
439HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
440{
441 Win32BaseWindow *window;
442 HWND rc;
443
444 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
445 if(!window) {
446 dprintf(("GetWindow, window %x not found", hwnd));
447 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
448 return 0;
449 }
450 return window->GetWindow(uCmd);
451}
452//******************************************************************************
453//******************************************************************************
454BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
455{
456 Win32BaseWindow *window;
457
458 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
459 if(!window) {
460 dprintf(("EnableWindow, window %x not found", hwnd));
461 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
462 return 0;
463 }
464 dprintf(("EnableWindow %x %d", hwnd, fEnable));
465 return window->EnableWindow(fEnable);
466}
467//******************************************************************************
468//******************************************************************************
469BOOL WIN32API BringWindowToTop(HWND hwnd)
470{
471 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
472}
473/***********************************************************************
474 * SetInternalWindowPos (USER32.483)
475 */
476void WIN32API SetInternalWindowPos(HWND hwnd,
477 UINT showCmd,
478 LPRECT lpRect,
479 LPPOINT lpPoint )
480{
481 dprintf(("USER32: SetInternalWindowPos(%08xh,%08xh,%08xh,%08xh)",
482 hwnd, showCmd, lpRect, lpPoint));
483
484 if( IsWindow(hwnd) )
485 {
486 WINDOWPLACEMENT wndpl;
487 UINT flags;
488
489 GetWindowPlacement(hwnd, &wndpl);
490 wndpl.length = sizeof(wndpl);
491 wndpl.showCmd = showCmd;
492 wndpl.flags = 0;
493
494 if(lpPoint)
495 {
496 wndpl.flags |= WPF_SETMINPOSITION;
497 wndpl.ptMinPosition = *lpPoint;
498 }
499 if(lpRect)
500 {
501 wndpl.rcNormalPosition = *lpRect;
502 }
503 SetWindowPlacement( hwnd, &wndpl);
504 }
505
506}
507/***********************************************************************
508 * GetInternalWindowPos (USER32.245)
509 */
510UINT WIN32API GetInternalWindowPos(HWND hwnd,
511 LPRECT rectWnd,
512 LPPOINT ptIcon )
513{
514 WINDOWPLACEMENT wndpl;
515
516 dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
517 hwnd,
518 rectWnd,
519 ptIcon));
520
521 if(GetWindowPlacement( hwnd, &wndpl ))
522 {
523 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
524 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
525 return wndpl.showCmd;
526 }
527 return 0;
528}
529//******************************************************************************
530//******************************************************************************
531HWND WIN32API GetActiveWindow()
532{
533 return Win32BaseWindow::GetActiveWindow();
534}
535//******************************************************************************
536//******************************************************************************
537BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
538{
539 Win32BaseWindow *window;
540
541 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
542 if(!window) {
543 dprintf(("ShowWindow, window %x not found", hwnd));
544 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
545 return 0;
546 }
547 return window->ShowWindow(nCmdShow);
548}
549/*****************************************************************************
550 * Name : BOOL WIN32API ShowWindowAsync
551 * Purpose : The ShowWindowAsync function sets the show state of a window
552 * created by a different thread.
553 * Parameters: HWND hwnd handle of window
554 * int nCmdShow show state of window
555 * Variables :
556 * Result : If the window was previously visible, the return value is TRUE.
557 * If the window was previously hidden, the return value is FALSE.
558 * Remark :
559 * Status : UNTESTED STUB
560 *
561 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
562 *****************************************************************************/
563BOOL WIN32API ShowWindowAsync (HWND hwnd,
564 int nCmdShow)
565{
566 dprintf(("USER32:ShowWindowAsync (%08xh,%08x) not correctly implemented.\n",
567 hwnd,
568 nCmdShow));
569
570 return ShowWindow(hwnd, nCmdShow);
571}
572//******************************************************************************
573//******************************************************************************
574BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
575{
576 Win32BaseWindow *window;
577
578 if (!hwnd)
579 {
580 dprintf(("SetWindowPos: Can't move desktop!"));
581 return TRUE;
582 }
583 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
584 if(!window) {
585 dprintf(("SetWindowPos, window %x not found", hwnd));
586 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
587 return FALSE;
588 }
589 dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
590 return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags);
591}
592//******************************************************************************
593//NOTE: length must equal structure size or else api fails (verified in NT4, SP6)
594//******************************************************************************
595BOOL WIN32API SetWindowPlacement(HWND hwnd, const WINDOWPLACEMENT *winpos)
596{
597 Win32BaseWindow *window;
598
599 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
600 if(!window) {
601 dprintf(("SetWindowPlacement, window %x not found", hwnd));
602 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
603 return FALSE;
604 }
605 if(!winpos || winpos->length != sizeof(WINDOWPLACEMENT)) {
606 dprintf(("SetWindowPlacement %x invalid parameter", hwnd));
607 SetLastError(ERROR_INVALID_PARAMETER);
608 return FALSE;
609 }
610 dprintf(("USER32: SetWindowPlacement %x %x", hwnd, winpos));
611 return window->SetWindowPlacement((WINDOWPLACEMENT *)winpos);
612}
613//******************************************************************************
614//NOTE: Length does not need to be correct (even though the SDK docs claim otherwise)
615// (Verified in NT4, SP6)
616//******************************************************************************
617BOOL WIN32API GetWindowPlacement(HWND hwnd, LPWINDOWPLACEMENT winpos)
618{
619 Win32BaseWindow *window;
620
621 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
622 if(!window) {
623 dprintf(("GetWindowPlacement, window %x not found", hwnd));
624 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
625 return FALSE;
626 }
627 if(!winpos) {
628 dprintf(("GetWindowPlacement %x invalid parameter", hwnd));
629 SetLastError(ERROR_INVALID_PARAMETER);
630 return FALSE;
631 }
632 dprintf(("USER32: GetWindowPlacement %x %x", hwnd, winpos));
633 return window->GetWindowPlacement(winpos);
634}
635//******************************************************************************
636//******************************************************************************
637BOOL WIN32API IsWindow( HWND hwnd)
638{
639 Win32BaseWindow *window;
640
641 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
642 if(!window) {
643 dprintf(("IsWindow, window %x not found", hwnd));
644 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
645 return FALSE;
646 }
647 dprintf2(("IsWindow %x", hwnd));
648 return window->IsWindow();
649}
650//******************************************************************************
651//******************************************************************************
652BOOL WIN32API IsWindowEnabled( HWND hwnd)
653{
654 Win32BaseWindow *window;
655
656 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
657 if(!window) {
658 dprintf(("IsWindowEnabled, window %x not found", hwnd));
659 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
660 return 0;
661 }
662 dprintf(("IsWindowEnabled %x", hwnd));
663 return window->IsWindowEnabled();
664}
665//******************************************************************************
666//******************************************************************************
667BOOL WIN32API IsWindowVisible( HWND hwnd)
668{
669 Win32BaseWindow *window;
670 BOOL rc;
671
672 if (hwnd)
673 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
674 else
675 window = windowDesktop;
676 if(!window) {
677 dprintf(("IsWindowVisible, window %x not found", hwnd));
678 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
679 return 0;
680 }
681 rc = window->IsWindowVisible();
682 dprintf(("IsWindowVisible %x returned %d", hwnd, rc));
683 return rc;
684}
685//******************************************************************************
686//******************************************************************************
687HWND WIN32API SetFocus (HWND hwnd)
688{
689 HWND lastFocus, lastFocus_W, hwnd_O;
690 BOOL activate;
691 TEB *teb;
692
693 teb = GetThreadTEB();
694 if(teb == NULL) {
695 DebugInt3();
696 return 0;
697 }
698
699 hwnd_O = Win32ToOS2Handle (hwnd);
700 lastFocus = OSLibWinQueryFocus (OSLIB_HWND_DESKTOP);
701 activate = ((hwnd_O == lastFocus) || OSLibWinIsChild (lastFocus, hwnd_O));
702 lastFocus_W = OS2ToWin32Handle (lastFocus);
703
704 dprintf(("SetFocus %x (%x) -> %x (%x)\n", lastFocus_W, lastFocus, hwnd, hwnd_O));
705
706 //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
707 //must delay this function call
708 if(teb->o.odin.fWM_SETFOCUS) {
709 dprintf(("USER32: Delay SetFocus call!"));
710 teb->o.odin.hwndFocus = hwnd;
711 //mp1 = win32 window handle
712 //mp2 = activate flag
713 OSLibPostMessageDirect(hwnd_O, WIN32APP_SETFOCUSMSG, hwnd, activate);
714 return lastFocus_W;
715 }
716 return (OSLibWinSetFocus (OSLIB_HWND_DESKTOP, hwnd_O, activate)) ? lastFocus_W : 0;
717}
718//******************************************************************************
719//******************************************************************************
720HWND WIN32API GetFocus(void)
721{
722 TEB *teb;
723 HWND hwnd;
724
725 teb = GetThreadTEB();
726 if(teb == NULL) {
727 DebugInt3();
728 return 0;
729 }
730 //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
731 //If focus was changed during WM_SETFOCUS, the focus window handle is
732 //stored in teb->o.odin.hwndFocus (set back to 0 when delayed SetFocus
733 //is activated)
734 if(teb->o.odin.hwndFocus) {
735 dprintf(("USER32: GetFocus %x (DURING WM_SETFOCUS PROCESSING)", teb->o.odin.hwndFocus));
736 return teb->o.odin.hwndFocus;
737 }
738
739 hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
740 hwnd = OS2ToWin32Handle(hwnd);
741 dprintf(("USER32: GetFocus %x\n", hwnd));
742 return hwnd;
743}
744//******************************************************************************
745//******************************************************************************
746BOOL WIN32API IsZoomed(HWND hwnd)
747{
748 DWORD style;
749
750 style = GetWindowLongA(hwnd, GWL_STYLE);
751 dprintf(("USER32: IsZoomed %x returned %d", hwnd, ((style & WS_MAXIMIZE) != 0)));
752
753 return (style & WS_MAXIMIZE) != 0;
754}
755//******************************************************************************
756//******************************************************************************
757BOOL WIN32API LockWindowUpdate(HWND hwnd)
758{
759 dprintf(("USER32: LockWindowUpdate %x", hwnd));
760 return OSLibWinLockWindowUpdate(Win32ToOS2Handle(hwnd));
761}
762//******************************************************************************
763//******************************************************************************
764BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
765{
766 Win32BaseWindow *window;
767
768 if (hwnd)
769 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
770 else
771 window = windowDesktop;
772
773 if(!window) {
774 dprintf(("GetWindowRect, window %x not found", hwnd));
775 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
776 return FALSE;
777 }
778 if(pRect == NULL) {
779 SetLastError(ERROR_INVALID_PARAMETER);
780 return FALSE;
781 }
782 *pRect = *window->getWindowRect();
783
784 //convert from parent coordinates to screen (if necessary)
785 if(window->getParent()) {
786 MapWindowPoints(window->getParent()->getWindowHandle(), 0, (PPOINT)pRect, 2);
787 }
788
789 dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
790 return TRUE;
791}
792//******************************************************************************
793//******************************************************************************
794int WIN32API GetWindowTextLengthA( HWND hwnd)
795{
796 Win32BaseWindow *window;
797
798 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
799 if(!window) {
800 dprintf(("GetWindowTextLength, window %x not found", hwnd));
801 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
802 return 0;
803 }
804 dprintf(("GetWindowTextLength %x", hwnd));
805 return window->GetWindowTextLength();
806}
807//******************************************************************************
808//******************************************************************************
809int WIN32API GetWindowTextA( HWND hwnd, LPSTR lpsz, int cch)
810{
811 Win32BaseWindow *window;
812 int rc;
813
814 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
815 if(!window) {
816 dprintf(("GetWindowTextA, window %x not found", hwnd));
817 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
818 return 0;
819 }
820 rc = window->GetWindowTextA(lpsz, cch);
821 dprintf(("GetWindowTextA %x %s", hwnd, lpsz));
822 return rc;
823}
824//******************************************************************************
825//******************************************************************************
826int WIN32API GetWindowTextLengthW( HWND hwnd)
827{
828 dprintf(("USER32: GetWindowTextLengthW\n"));
829 return GetWindowTextLengthA(hwnd);
830}
831//******************************************************************************
832//******************************************************************************
833int WIN32API GetWindowTextW(HWND hwnd, LPWSTR lpsz, int cch)
834{
835 Win32BaseWindow *window;
836
837 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
838 if(!window) {
839 dprintf(("GetWindowTextW, window %x not found", hwnd));
840 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
841 return 0;
842 }
843#ifdef DEBUG
844 int rc = window->GetWindowTextW(lpsz, cch);
845 dprintf(("GetWindowTextW %x %ls", hwnd, lpsz));
846 return rc;
847#else
848 return window->GetWindowTextW(lpsz, cch);
849#endif
850}
851//******************************************************************************
852//******************************************************************************
853BOOL WIN32API SetWindowTextA(HWND hwnd, LPCSTR lpsz)
854{
855 Win32BaseWindow *window;
856
857 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
858 if(!window) {
859 dprintf(("SetWindowTextA, window %x not found", hwnd));
860 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
861 return 0;
862 }
863 dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
864 return window->SetWindowTextA((LPSTR)lpsz);
865}
866//******************************************************************************
867//******************************************************************************
868BOOL WIN32API SetWindowTextW( HWND hwnd, LPCWSTR lpsz)
869{
870 Win32BaseWindow *window;
871
872 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
873 if(!window) {
874 dprintf(("SetWindowTextA, window %x not found", hwnd));
875 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
876 return 0;
877 }
878 dprintf(("SetWindowTextW %x %ls", hwnd, lpsz));
879 return window->SetWindowTextW((LPWSTR)lpsz);
880}
881/*******************************************************************
882 * InternalGetWindowText (USER32.326)
883 */
884int WIN32API InternalGetWindowText(HWND hwnd,
885 LPWSTR lpString,
886 INT nMaxCount )
887{
888 dprintf(("USER32: InternalGetWindowText(%08xh,%08xh,%08xh) not properly implemented.\n",
889 hwnd,
890 lpString,
891 nMaxCount));
892
893 return GetWindowTextW(hwnd,lpString,nMaxCount);
894}
895//******************************************************************************
896//TODO: Correct?
897//******************************************************************************
898BOOL WIN32API SetForegroundWindow(HWND hwnd)
899{
900 dprintf((" SetForegroundWindow %x", hwnd));
901
902 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
903}
904//******************************************************************************
905//******************************************************************************
906BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
907{
908 HWND hwndWin32 = hwnd;
909 Win32BaseWindow *window;
910
911 if (!pRect)
912 {
913 SetLastError(ERROR_INVALID_PARAMETER);
914 return FALSE;
915 }
916 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
917 if(!window) {
918 dprintf(("GetClientRect, window %x not found", hwnd));
919 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
920 return FALSE;
921 }
922 window->getClientRect(pRect);
923 dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom));
924 return TRUE;
925}
926//******************************************************************************
927//******************************************************************************
928BOOL WIN32API AdjustWindowRect(PRECT rect, DWORD style, BOOL menu)
929{
930 return AdjustWindowRectEx(rect, style, menu, 0);
931}
932//******************************************************************************
933//Calculate window rectangle based on given client rectangle, style, menu and extended style
934//******************************************************************************
935BOOL WIN32API AdjustWindowRectEx( PRECT rect, DWORD style, BOOL menu, DWORD exStyle)
936{
937 if(style == 0 && menu == FALSE && exStyle == 0) {
938 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d) -> no change required", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom));
939 return TRUE; //nothing needs to be changed (VERIFIED in NT 4)
940 }
941 dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d)\n", style, exStyle, menu, rect->left, rect->top, rect->right, rect->bottom));
942 /* Correct the window style */
943 if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
944 style |= WS_CAPTION;
945
946 //SvL: Include WS_POPUP -> otherwise HAS_THINFRAME is true for popup windows
947 // Also include WS_CHILD -> otherwise HAS_THICKFRAME doesn't work correctly
948 style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_POPUP);
949 exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
950 if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
951
952 //Adjust rect outer (Win32BaseWindow::AdjustRectOuter)
953 if (HAS_THICKFRAME(style,exStyle))
954 InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
955 else
956 if (HAS_DLGFRAME(style,exStyle))
957 InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
958 else
959 if (HAS_THINFRAME(style))
960 InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
961
962 if ((style & WS_CAPTION) == WS_CAPTION)
963 {
964 if (exStyle & WS_EX_TOOLWINDOW)
965 rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
966 else
967 rect->top -= GetSystemMetrics(SM_CYCAPTION);
968 }
969
970 if (menu)
971 rect->top -= GetSystemMetrics(SM_CYMENU);
972
973 //Adjust rect inner (Win32BaseWindow::AdjustRectInner)
974 if(!(style & WS_ICONIC)) {
975 if (exStyle & WS_EX_CLIENTEDGE)
976 InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
977
978 if (exStyle & WS_EX_STATICEDGE)
979 InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
980
981 //SvL: scrollbars aren't checked *UNLESS* the style includes a border (any border)
982 // --> VERIFIED IN NT4, SP6 (fixes MFC apps with scrollbars + bar controls)
983 if(style & (WS_THICKFRAME|WS_BORDER|WS_DLGFRAME)) {
984 if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL);
985 if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
986 }
987 }
988
989 dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom));
990
991 return TRUE;
992}
993//******************************************************************************
994/* Coordinate Space and Transformation Functions */
995//******************************************************************************
996/*******************************************************************
997 * WINPOS_GetWinOffset
998 *
999 * Calculate the offset between the origin of the two windows. Used
1000 * to implement MapWindowPoints.
1001 */
1002static void WINPOS_GetWinOffset( Win32BaseWindow *wndFrom, Win32BaseWindow *wndTo,
1003 POINT *offset )
1004{
1005 Win32BaseWindow *window;
1006
1007 offset->x = offset->y = 0;
1008
1009 /* Translate source window origin to screen coords */
1010 if(wndFrom != windowDesktop)
1011 {
1012 window = wndFrom;
1013 while(window)
1014 {
1015 offset->x += window->getClientRectPtr()->left + window->getWindowRect()->left;
1016 offset->y += window->getClientRectPtr()->top + window->getWindowRect()->top;
1017 window = window->getParent();
1018 }
1019 }
1020
1021 /* Translate origin to destination window coords */
1022 if(wndTo != windowDesktop)
1023 {
1024 window = wndTo;
1025 while(window)
1026 {
1027 offset->x -= window->getClientRectPtr()->left + window->getWindowRect()->left;
1028 offset->y -= window->getClientRectPtr()->top + window->getWindowRect()->top;
1029 window = window->getParent();
1030 }
1031 }
1032}
1033//******************************************************************************
1034//******************************************************************************
1035int WIN32API MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints,
1036 UINT cPoints)
1037{
1038 Win32BaseWindow *wndfrom, *wndto;
1039 int retval = 0;
1040 POINT offset;
1041
1042 SetLastError(0);
1043 if(lpPoints == NULL || cPoints == 0) {
1044 SetLastError(ERROR_INVALID_PARAMETER);
1045 return 0;
1046 }
1047 if(hwndFrom)
1048 {
1049 wndfrom = Win32BaseWindow::GetWindowFromHandle(hwndFrom);
1050 if(!wndfrom) {
1051 dprintf(("MapWindowPoints, window %x not found", hwndFrom));
1052 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1053 return 0;
1054 }
1055 }
1056 else wndfrom = windowDesktop;
1057
1058 if(hwndTo)
1059 {
1060 wndto = Win32BaseWindow::GetWindowFromHandle(hwndTo);
1061 if(!wndto) {
1062 dprintf(("MapWindowPoints, window %x not found", hwndTo));
1063 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1064 return 0;
1065 }
1066 }
1067 else wndto = windowDesktop;
1068
1069 if(wndto == wndfrom)
1070 return 0; //nothing to do
1071
1072 dprintf2(("USER32: MapWindowPoints %x to %x (%d,%d) (%d)", hwndFrom, hwndTo, lpPoints->x, lpPoints->y, cPoints));
1073 WINPOS_GetWinOffset(wndfrom, wndto, &offset);
1074
1075 for(int i=0;i<cPoints;i++)
1076 {
1077 lpPoints[i].x += offset.x;
1078 lpPoints[i].y += offset.y;
1079 }
1080 retval = ((LONG)offset.y << 16) | offset.x;
1081 return retval;
1082}
1083//******************************************************************************
1084//******************************************************************************
1085BOOL WIN32API ScreenToClient(HWND hwnd, LPPOINT pt)
1086{
1087 Win32BaseWindow *wnd;
1088 PRECT rcl;
1089 BOOL rc;
1090
1091 if(!hwnd) {
1092 return (TRUE);
1093 }
1094 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1095 if (!wnd) {
1096 dprintf(("warning: ScreenToClient: window %x not found!", hwnd));
1097 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1098 return FALSE;
1099 }
1100 SetLastError(0);
1101#ifdef DEBUG
1102 POINT tmp = *pt;
1103#endif
1104 MapWindowPoints(0, hwnd, pt, 1);
1105 dprintf2(("ScreenToClient %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y));
1106 return TRUE;
1107}
1108//******************************************************************************
1109//******************************************************************************
1110HWND WIN32API GetDesktopWindow(void)
1111{
1112 HWND DesktopWindow = windowDesktop->getWindowHandle();
1113 dprintf2(("USER32: GetDesktopWindow, returned %x\n", DesktopWindow));
1114 return DesktopWindow;
1115}
1116//******************************************************************************
1117//******************************************************************************
1118HWND WIN32API FindWindowA(LPCSTR lpszClass, LPCSTR lpszWindow)
1119{
1120 return FindWindowExA( NULL, NULL, lpszClass, lpszWindow );
1121}
1122//******************************************************************************
1123//******************************************************************************
1124HWND WIN32API FindWindowW( LPCWSTR lpClassName, LPCWSTR lpWindowName)
1125{
1126 return FindWindowExW( NULL, NULL, lpClassName, lpWindowName );
1127}
1128//******************************************************************************
1129//******************************************************************************
1130HWND WIN32API FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
1131{
1132 ATOM atom = 0;
1133
1134 if (lpszClass)
1135 {
1136 /* If the atom doesn't exist, then no class */
1137 /* with this name exists either. */
1138 if (!(atom = GlobalFindAtomA( lpszClass )))
1139 {
1140 SetLastError(ERROR_CANNOT_FIND_WND_CLASS);
1141 return 0;
1142 }
1143 }
1144 return Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, atom, (LPSTR)lpszWindow);
1145}
1146/*****************************************************************************
1147 * Name : HWND WIN32API FindWindowExW
1148 * Purpose : The FindWindowEx function retrieves the handle of a window whose
1149 * class name and window name match the specified strings. The
1150 * function searches child windows, beginning with the one following
1151 * the given child window.
1152 * Parameters: HWND hwndParent handle of parent window
1153 * HWND hwndChildAfter handle of a child window
1154 * LPCTSTR lpszClass address of class name
1155 * LPCTSTR lpszWindow address of window name
1156 * Variables :
1157 * Result : If the function succeeds, the return value is the handle of the
1158 * window that has the specified class and window names.
1159 * If the function fails, the return value is NULL. To get extended
1160 * error information, call GetLastError.
1161 * Remark :
1162 *
1163 *****************************************************************************/
1164
1165HWND WIN32API FindWindowExW(HWND hwndParent,
1166 HWND hwndChildAfter,
1167 LPCWSTR lpszClass,
1168 LPCWSTR lpszWindow)
1169{
1170 ATOM atom = 0;
1171 char *buffer;
1172 HWND hwnd;
1173
1174 if (lpszClass)
1175 {
1176 /* If the atom doesn't exist, then no class */
1177 /* with this name exists either. */
1178 if (!(atom = GlobalFindAtomW( lpszClass )))
1179 {
1180 SetLastError(ERROR_CANNOT_FIND_WND_CLASS);
1181 return 0;
1182 }
1183 }
1184 buffer = HEAP_strdupWtoA( GetProcessHeap(), 0, lpszWindow );
1185 hwnd = Win32BaseWindow::FindWindowEx(hwndParent, hwndChildAfter, atom, buffer);
1186 HeapFree( GetProcessHeap(), 0, buffer );
1187 return hwnd;
1188}
1189//******************************************************************************
1190//******************************************************************************
1191BOOL WIN32API FlashWindow(HWND hwnd, BOOL fFlash)
1192{
1193 dprintf(("FlashWindow %x %d\n", hwnd, fFlash));
1194// return OSLibWinFlashWindow(Win32ToOS2Handle(hwnd), fFlash);
1195 return 1;
1196}
1197//******************************************************************************
1198//******************************************************************************
1199BOOL WIN32API MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
1200 BOOL repaint )
1201{
1202 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
1203
1204 if (!repaint) flags |= SWP_NOREDRAW;
1205 dprintf(("MoveWindow: %x %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint ));
1206
1207 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
1208}
1209//******************************************************************************
1210//******************************************************************************
1211BOOL WIN32API ClientToScreen (HWND hwnd, PPOINT pt)
1212{
1213 Win32BaseWindow *wnd;
1214 PRECT rcl;
1215
1216 if (!hwnd) {
1217 SetLastError(ERROR_INVALID_PARAMETER);
1218 return (FALSE);
1219 }
1220 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
1221 if (!wnd) {
1222 dprintf(("warning: ClientToScreen window %x not found!", hwnd));
1223 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1224 return (FALSE);
1225 }
1226#ifdef DEBUG
1227 POINT tmp = *pt;
1228#endif
1229 MapWindowPoints(hwnd, 0, pt, 1);
1230 dprintf2(("ClientToScreen %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y));
1231
1232 return TRUE;
1233}
1234//******************************************************************************
1235//Note: count 0 is a legal parameter (verified in NT4)
1236//******************************************************************************
1237HDWP WIN32API BeginDeferWindowPos(int count)
1238{
1239 HDWP handle;
1240 DWP *pDWP;
1241
1242 if (count < 0)
1243 {
1244 dprintf(("USER32: BeginDeferWindowPos invalid param %d", count));
1245 SetLastError(ERROR_INVALID_PARAMETER);
1246 return 0;
1247 }
1248 dprintf(("USER32: BeginDeferWindowPos %d", count));
1249 if(count == 0)
1250 count = 8; // change to any non-zero value
1251
1252 handle = (HDWP)HeapAlloc(GetProcessHeap(), 0, sizeof(DWP) + (count-1)*sizeof(WINDOWPOS));
1253 if (!handle)
1254 return 0;
1255
1256 pDWP = (DWP *) handle;
1257 pDWP->actualCount = 0;
1258 pDWP->suggestedCount = count;
1259 pDWP->valid = TRUE;
1260 pDWP->wMagic = DWP_MAGIC;
1261 pDWP->hwndParent = 0;
1262 return handle;
1263}
1264/***********************************************************************
1265 * DeferWindowPos (USER32.128)
1266 *
1267 * TODO: SvL: Does this need to be thread safe?
1268 *
1269 */
1270HDWP WIN32API DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
1271 INT x, INT y, INT cx, INT cy,
1272 UINT flags )
1273{
1274 DWP *pDWP;
1275 int i;
1276 HDWP newhdwp = hdwp,retvalue;
1277 Win32BaseWindow *window;
1278
1279 pDWP = (DWP *)hdwp;
1280 if (!pDWP) {
1281 SetLastError(ERROR_INVALID_PARAMETER);
1282 return 0;
1283 }
1284
1285 if (hwnd == GetDesktopWindow())
1286 return 0;
1287
1288 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1289 if(!window) {
1290 dprintf(("DeferWindowPos, window %x not found", hwnd));
1291 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1292 HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
1293 return 0;
1294 }
1295
1296 dprintf(("USER32: DeferWindowPos hdwp %x hwnd %x hwndAfter %x (%d,%d)(%d,%d) %x", hdwp, hwnd, hwndAfter,
1297 x, y, cx, cy, flags));
1298
1299/* Numega Bounds Checker Demo dislikes the following code.
1300 In fact, I've not been able to find any "same parent" requirement in any docu
1301 [AM 980509]
1302 */
1303#if 0
1304 /* All the windows of a DeferWindowPos() must have the same parent */
1305 parent = pWnd->parent->hwndSelf;
1306 if (pDWP->actualCount == 0) pDWP->hwndParent = parent;
1307 else if (parent != pDWP->hwndParent)
1308 {
1309 USER_HEAP_FREE( hdwp );
1310 retvalue = 0;
1311 goto END;
1312 }
1313#endif
1314
1315 for (i = 0; i < pDWP->actualCount; i++)
1316 {
1317 if (pDWP->winPos[i].hwnd == hwnd)
1318 {
1319 /* Merge with the other changes */
1320 if (!(flags & SWP_NOZORDER))
1321 {
1322 pDWP->winPos[i].hwndInsertAfter = hwndAfter;
1323 }
1324 if (!(flags & SWP_NOMOVE))
1325 {
1326 pDWP->winPos[i].x = x;
1327 pDWP->winPos[i].y = y;
1328 }
1329 if (!(flags & SWP_NOSIZE))
1330 {
1331 pDWP->winPos[i].cx = cx;
1332 pDWP->winPos[i].cy = cy;
1333 }
1334 pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
1335 SWP_NOZORDER | SWP_NOREDRAW |
1336 SWP_NOACTIVATE | SWP_NOCOPYBITS|
1337 SWP_NOOWNERZORDER);
1338 pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
1339 SWP_FRAMECHANGED);
1340 retvalue = hdwp;
1341 goto END;
1342 }
1343 }
1344 if (pDWP->actualCount >= pDWP->suggestedCount)
1345 {
1346 //DWP structure already contains WINDOWPOS, allocated with (count-1)
1347 //in BeginDeferWindowPos; pDWP->suggestedCount alloc increases it by one
1348 newhdwp = (HDWP)HeapReAlloc(GetProcessHeap(), 0, (LPVOID)hdwp,
1349 sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS));
1350 if (!newhdwp)
1351 {
1352 retvalue = 0;
1353 goto END;
1354 }
1355 pDWP = (DWP *) newhdwp;
1356 pDWP->suggestedCount++;
1357 }
1358 pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
1359 pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
1360 pDWP->winPos[pDWP->actualCount].x = x;
1361 pDWP->winPos[pDWP->actualCount].y = y;
1362 pDWP->winPos[pDWP->actualCount].cx = cx;
1363 pDWP->winPos[pDWP->actualCount].cy = cy;
1364 pDWP->winPos[pDWP->actualCount].flags = flags;
1365 pDWP->actualCount++;
1366 retvalue = newhdwp;
1367END:
1368 return retvalue;
1369}
1370//******************************************************************************
1371//******************************************************************************
1372BOOL WIN32API EndDeferWindowPos( HDWP hdwp)
1373{
1374 DWP *pDWP;
1375 WINDOWPOS *winpos;
1376 BOOL res = TRUE;
1377 int i;
1378
1379 pDWP = (DWP *) hdwp;
1380 if (!pDWP) {
1381 dprintf(("**EndDeferWindowPos invalid parameter\n"));
1382 SetLastError(ERROR_INVALID_PARAMETER);
1383 return FALSE;
1384 }
1385 dprintf(("**EndDeferWindowPos for %d windows", pDWP->actualCount));
1386 for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
1387 {
1388 dprintf(("**EndDeferWindowPos %x (%d,%d) (%d,%d) %x", winpos->hwnd, winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags));
1389 if (!(res = SetWindowPos(winpos->hwnd, winpos->hwndInsertAfter,
1390 winpos->x, winpos->y, winpos->cx,
1391 winpos->cy, winpos->flags )))
1392 break;
1393 }
1394 dprintf(("**EndDeferWindowPos DONE"));
1395 HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
1396 return res;
1397}
1398//******************************************************************************
1399//******************************************************************************
1400HWND WIN32API ChildWindowFromPoint( HWND hwnd, POINT pt)
1401{
1402 dprintf(("USER32: ChildWindowFromPoint\n"));
1403 return ChildWindowFromPointEx(hwnd, pt, 0);
1404}
1405/*****************************************************************************
1406 * Name : HWND WIN32API ChildWindowFromPointEx
1407 * Purpose : pt: client coordinates
1408 * Parameters:
1409 * Variables :
1410 * Result : If the function succeeds, the return value is the window handle.
1411 * If the function fails, the return value is zero
1412 * Remark :
1413 * Status : COMPLETELY IMPLEMENTED AND TESTED
1414 *
1415 * Author : Rene Pronk [Sun, 1999/08/08 23:30]
1416 *****************************************************************************/
1417HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
1418{
1419 RECT rect;
1420 HWND hWnd;
1421
1422 dprintf(("ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n",
1423 hwndParent, pt, uFlags));
1424
1425 if (GetWindowRect (hwndParent, &rect) == 0) {
1426 // oops, invalid handle
1427 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1428 return NULL;
1429 }
1430
1431 ClientToScreen(hwndParent, &pt);
1432 if (PtInRect (&rect, pt) == 0) {
1433 // point is outside window
1434 return NULL;
1435 }
1436
1437 // get first child
1438 hWnd = GetWindow (hwndParent, GW_CHILD);
1439
1440 while (hWnd != NULL)
1441 {
1442 // do I need to skip this window?
1443 if (((uFlags & CWP_SKIPINVISIBLE) &&
1444 (IsWindowVisible (hWnd) == FALSE)) ||
1445 ((uFlags & CWP_SKIPDISABLED) &&
1446 (IsWindowEnabled (hWnd) == FALSE)) ||
1447 ((uFlags & CWP_SKIPTRANSPARENT) &&
1448 (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
1449 {
1450 hWnd = GetWindow (hWnd, GW_HWNDNEXT);
1451 continue;
1452 }
1453
1454 // is the point in this window's rect?
1455 GetWindowRect (hWnd, &rect);
1456 if (PtInRect (&rect,pt) == FALSE) {
1457 hWnd = GetWindow (hWnd, GW_HWNDNEXT);
1458 continue;
1459 }
1460
1461 dprintf(("ChildWindowFromPointEx returned %x", hWnd));
1462 // found it!
1463 return hWnd;
1464 }
1465 // the point is in the parentwindow but the parentwindow has no child
1466 // at this coordinate
1467 dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent));
1468 return hwndParent;
1469}
1470//******************************************************************************
1471//******************************************************************************
1472BOOL WIN32API CloseWindow(HWND hwnd)
1473{
1474 Win32BaseWindow *window;
1475
1476 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1477 if(!window) {
1478 dprintf(("CloseWindow, window %x not found", hwnd));
1479 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1480 return 0;
1481 }
1482 dprintf(("CloseWindow %x\n", hwnd));
1483 return window->CloseWindow();
1484}
1485//******************************************************************************
1486//TODO: Does this return handles of hidden or disabled windows?
1487//******************************************************************************
1488HWND WIN32API WindowFromPoint( POINT point)
1489{
1490 HWND hwndOS2, hwnd;
1491 POINT wPoint;
1492 DWORD hittest, dwStyle, dwExStyle;
1493
1494 wPoint.x = point.x;
1495 wPoint.y = mapScreenY(point.y);
1496
1497 hwndOS2 = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&wPoint);
1498 if(hwndOS2)
1499 {
1500 hwnd = OS2ToWin32Handle(hwndOS2);
1501 while(hwnd)
1502 {
1503 dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
1504 dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
1505
1506 /* If point is in window, and window is visible, and it */
1507 /* is enabled (or it's a top-level window), then explore */
1508 /* its children. Otherwise, go to the next window. */
1509
1510 if( (dwStyle & WS_VISIBLE) &&
1511 ((dwExStyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) != (WS_EX_LAYERED | WS_EX_TRANSPARENT)) &&
1512 (!(dwStyle & WS_DISABLED) || ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD))
1513#if 1
1514 )
1515#else
1516 &&
1517 (wndPtr->hrgnWnd ? PtInRegion(wndPtr->hrgnWnd, 1))
1518#endif
1519 {
1520 hittest = SendMessageA(hwnd, WM_NCHITTEST, 0, MAKELONG(point.x, point.y));
1521 if(hittest != HTTRANSPARENT) {
1522 dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
1523 return hwnd;
1524 }
1525 }
1526 //TODO: Not correct for overlapping sibling windows!
1527 hwnd = GetParent(hwnd);
1528 }
1529 }
1530 dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2));
1531 return windowDesktop->getWindowHandle();
1532}
1533//******************************************************************************
1534//******************************************************************************
1535BOOL WIN32API IsWindowUnicode(HWND hwnd)
1536{
1537 Win32BaseWindow *window;
1538
1539 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1540 if(!window) {
1541 dprintf(("IsWindowUnicode, window %x not found", hwnd));
1542 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1543 return 0;
1544 }
1545 return window->IsWindowUnicode();
1546}
1547/***********************************************************************
1548 * SwitchToThisWindow (USER32.539)
1549 */
1550DWORD WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
1551{
1552 return ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
1553}
1554//******************************************************************************
1555//******************************************************************************
1556BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
1557{
1558 return windowDesktop->EnumThreadWindows(dwThreadId, lpfn, lParam);
1559}
1560//******************************************************************************
1561//******************************************************************************
1562BOOL WIN32API EnumChildWindows(HWND hwnd, WNDENUMPROC lpfn, LPARAM lParam)
1563{
1564 Win32BaseWindow *window;
1565 BOOL rc = TRUE;
1566 ULONG henum;
1567 HWND hwndNext;
1568
1569 if(lpfn == NULL) {
1570 dprintf(("EnumChildWindows invalid parameter %x %x\n", hwnd, lParam));
1571 SetLastError(ERROR_INVALID_PARAMETER);
1572 return FALSE;
1573 }
1574 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1575 if(!window) {
1576 dprintf(("EnumChildWindows, window %x not found", hwnd));
1577 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1578 return FALSE;
1579 }
1580 return window->EnumChildWindows(lpfn, lParam);
1581}
1582//******************************************************************************
1583//******************************************************************************
1584BOOL WIN32API EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
1585{
1586 return windowDesktop->EnumWindows(lpfn, lParam);
1587}
1588//******************************************************************************
1589//******************************************************************************
1590UINT WIN32API ArrangeIconicWindows( HWND hwnd)
1591{
1592 dprintf(("USER32: ArrangeIconicWindows %x", hwnd));
1593 return O32_ArrangeIconicWindows(Win32ToOS2Handle(hwnd));
1594}
1595//******************************************************************************
1596//restores iconized window to previous size/position
1597//******************************************************************************
1598BOOL WIN32API OpenIcon(HWND hwnd)
1599{
1600 dprintf(("USER32: OpenIcon %x", hwnd));
1601
1602 if(!IsIconic(hwnd))
1603 return FALSE;
1604 ShowWindow(hwnd, SW_SHOWNORMAL);
1605 return TRUE;
1606}
1607//******************************************************************************
1608//SDK: Windows can only be shown with ShowOwnedPopups if they were previously
1609// hidden with the same api
1610//TODO: -> needs testing
1611//******************************************************************************
1612BOOL WIN32API ShowOwnedPopups(HWND hwndOwner, BOOL fShow)
1613{
1614 Win32BaseWindow *window, *owner;
1615 HWND hwnd;
1616
1617 owner = Win32BaseWindow::GetWindowFromHandle(hwndOwner);
1618 if(!owner) {
1619 dprintf(("ShowOwnedPopups, window %x not found", hwndOwner));
1620 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1621 return FALSE;
1622 }
1623 dprintf(("USER32: ShowOwnedPopups %x %d", hwnd, fShow));
1624
1625 hwnd = GetWindow(GetDesktopWindow(), GW_CHILD);
1626 while(hwnd) {
1627 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1628 if(window) {
1629 if(window == owner && (window->getStyle() & WS_POPUP))
1630 {
1631 if(fShow) {
1632 if(window->getFlags() & WIN_NEEDS_SHOW_OWNEDPOPUP)
1633 {
1634 /*
1635 * In Windows, ShowOwnedPopups(TRUE) generates WM_SHOWWINDOW messages with SW_PARENTOPENING,
1636 * regardless of the state of the owner
1637 */
1638 SendMessageA(hwnd, WM_SHOWWINDOW, SW_SHOW, SW_PARENTOPENING);
1639 window->setFlags(window->getFlags() & ~WIN_NEEDS_SHOW_OWNEDPOPUP);
1640 }
1641 }
1642 else
1643 {
1644 if(IsWindowVisible(hwnd))
1645 {
1646 /*
1647 * In Windows, ShowOwnedPopups(FALSE) generates WM_SHOWWINDOW messages with SW_PARENTCLOSING,
1648 * regardless of the state of the owner
1649 */
1650 SendMessageA(hwnd, WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING);
1651 window->setFlags(window->getFlags() | WIN_NEEDS_SHOW_OWNEDPOPUP);
1652 }
1653 }
1654 }
1655 }
1656 else dprintf(("WARNING: window %x is not valid", hwnd));
1657
1658 hwnd = GetWindow(hwnd, GW_HWNDNEXT);
1659 }
1660 return TRUE;
1661}
1662//******************************************************************************
1663//******************************************************************************
1664HWND WIN32API GetForegroundWindow(void)
1665{
1666 HWND hwnd;
1667
1668 hwnd = OS2ToWin32Handle(OSLibWinQueryActiveWindow());
1669 dprintf(("USER32: GetForegroundWindow returned %x", hwnd));
1670 return hwnd;
1671}
1672//******************************************************************************
1673//******************************************************************************
1674HWND WIN32API GetLastActivePopup( HWND hWnd)
1675{
1676 HWND hwnd;
1677
1678 hwnd = Win32ToOS2Handle(hWnd);
1679 hwnd = OS2ToWin32Handle(O32_GetLastActivePopup(hwnd));
1680
1681 dprintf(("GetLastActivePopup %x returned %x NOT CORRECTLY IMPLEMENTED", hWnd, hwnd));
1682 return hwnd;
1683}
1684//******************************************************************************
1685//******************************************************************************
1686DWORD WIN32API GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
1687{
1688 dprintf2(("USER32: GetWindowThreadProcessId"));
1689 hWnd = Win32ToOS2Handle(hWnd);
1690
1691 return O32_GetWindowThreadProcessId(hWnd,lpdwProcessId);
1692}
1693//******************************************************************************
1694//******************************************************************************
1695DWORD WIN32API GetWindowContextHelpId(HWND hwnd)
1696{
1697 Win32BaseWindow *window;
1698
1699 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1700 if(!window) {
1701 dprintf(("GetWindowContextHelpId, window %x not found", hwnd));
1702 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1703 return 0;
1704 }
1705 dprintf(("GetWindowContextHelpId %x", hwnd));
1706 return window->getWindowContextHelpId();
1707}
1708//******************************************************************************
1709//******************************************************************************
1710BOOL WIN32API SetWindowContextHelpId(HWND hwnd, DWORD dwContextHelpId)
1711{
1712 Win32BaseWindow *window;
1713
1714 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1715 if(!window) {
1716 dprintf(("SetWindowContextHelpId, window %x not found", hwnd));
1717 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1718 return 0;
1719 }
1720 dprintf(("SetWindowContextHelpId %x %d", hwnd, dwContextHelpId));
1721 window->setWindowContextHelpId(dwContextHelpId);
1722 return(TRUE);
1723}
1724//******************************************************************************
1725//******************************************************************************
1726HANDLE WINAPI GetPropA( HWND hwnd, LPCSTR str )
1727{
1728 Win32BaseWindow *window;
1729
1730 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1731 if(!window) {
1732 dprintf(("GetPropA, window %x not found", hwnd));
1733 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1734 return 0;
1735 }
1736 return window->getProp(str);
1737}
1738//******************************************************************************
1739//******************************************************************************
1740HANDLE WINAPI GetPropW( HWND hwnd, LPCWSTR str )
1741{
1742 LPSTR strA;
1743 HANDLE ret;
1744
1745 if (!HIWORD(str)) return GetPropA( hwnd, (LPCSTR)(UINT)LOWORD(str) );
1746 strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
1747 ret = GetPropA( hwnd, strA );
1748 HeapFree( GetProcessHeap(), 0, strA );
1749 return ret;
1750}
1751//******************************************************************************
1752//******************************************************************************
1753BOOL WINAPI SetPropA( HWND hwnd, LPCSTR str, HANDLE handle )
1754{
1755 Win32BaseWindow *window;
1756
1757 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1758 if(!window) {
1759 dprintf(("SetPropA, window %x not found", hwnd));
1760 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1761 return FALSE;
1762 }
1763 return window->setProp(str, handle);
1764}
1765//******************************************************************************
1766//******************************************************************************
1767BOOL WINAPI SetPropW( HWND hwnd, LPCWSTR str, HANDLE handle )
1768{
1769 BOOL ret;
1770 LPSTR strA;
1771
1772 if (!HIWORD(str))
1773 return SetPropA( hwnd, (LPCSTR)(UINT)LOWORD(str), handle );
1774 strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
1775 ret = SetPropA( hwnd, strA, handle );
1776 HeapFree( GetProcessHeap(), 0, strA );
1777 return ret;
1778}
1779//******************************************************************************
1780//******************************************************************************
1781HANDLE WINAPI RemovePropA( HWND hwnd, LPCSTR str )
1782{
1783 Win32BaseWindow *window;
1784
1785 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1786 if(!window) {
1787 dprintf(("RemovePropA, window %x not found", hwnd));
1788 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1789 return 0;
1790 }
1791 return window->removeProp(str);
1792}
1793//******************************************************************************
1794//******************************************************************************
1795HANDLE WINAPI RemovePropW( HWND hwnd, LPCWSTR str )
1796{
1797 LPSTR strA;
1798 HANDLE ret;
1799
1800 if (!HIWORD(str))
1801 return RemovePropA( hwnd, (LPCSTR)(UINT)LOWORD(str) );
1802 strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
1803 ret = RemovePropA( hwnd, strA );
1804 HeapFree( GetProcessHeap(), 0, strA );
1805 return ret;
1806}
1807//******************************************************************************
1808//******************************************************************************
1809INT WINAPI EnumPropsA( HWND hwnd, PROPENUMPROCA func )
1810{
1811 return EnumPropsExA( hwnd, (PROPENUMPROCEXA)func, 0 );
1812}
1813//******************************************************************************
1814//******************************************************************************
1815INT WINAPI EnumPropsW( HWND hwnd, PROPENUMPROCW func )
1816{
1817 return EnumPropsExW( hwnd, (PROPENUMPROCEXW)func, 0 );
1818}
1819//******************************************************************************
1820//******************************************************************************
1821INT WINAPI EnumPropsExA(HWND hwnd, PROPENUMPROCEXA func, LPARAM lParam)
1822{
1823 Win32BaseWindow *window;
1824
1825 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1826 if(!window) {
1827 dprintf(("EnumPropsExA, window %x not found", hwnd));
1828 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1829 return -1;
1830 }
1831 return window->enumPropsExA(func, lParam);
1832}
1833//******************************************************************************
1834//******************************************************************************
1835INT WINAPI EnumPropsExW(HWND hwnd, PROPENUMPROCEXW func, LPARAM lParam)
1836{
1837 Win32BaseWindow *window;
1838
1839 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
1840 if(!window) {
1841 dprintf(("EnumPropsExA, window %x not found", hwnd));
1842 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
1843 return -1;
1844 }
1845 return window->enumPropsExW(func, lParam);
1846}
1847//******************************************************************************
1848//******************************************************************************
Note: See TracBrowser for help on using the repository browser.