source: trunk/src/user32/new/window.cpp@ 724

Last change on this file since 724 was 724, checked in by sandervl, 26 years ago

Use shared memory for class & window objects

File size: 33.6 KB
Line 
1/* $Id: window.cpp,v 1.17 1999-08-28 14:09:30 sandervl Exp $ */
2/*
3 * Win32 window apis for OS/2
4 *
5 * Copyright 1999 Sander van Leeuwen
6 *
7 * Parts based on Wine Windows code (windows\win.c)
8 *
9 * Copyright 1993, 1994 Alexandre Julliard
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 *
14 * TODO: Decide what to do about commands for OS/2 windows (non-Win32 apps)
15 *
16 */
17
18#include <os2win.h>
19#include <misc.h>
20#include <win32wnd.h>
21#include <oslibwin.h>
22#include <oslibgdi.h>
23#include "user32.h"
24#include "winicon.h"
25#include "usrcall.h"
26
27//******************************************************************************
28//******************************************************************************
29HWND WIN32API CreateWindowExA(DWORD exStyle, LPCSTR className,
30 LPCSTR windowName, DWORD style, INT x,
31 INT y, INT width, INT height,
32 HWND parent, HMENU menu,
33 HINSTANCE instance, LPVOID data )
34{
35 Win32Window *window;
36 ATOM classAtom;
37 CREATESTRUCTA cs;
38
39 if(exStyle & WS_EX_MDICHILD)
40 return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
41
42 /* Find the class atom */
43 if (!(classAtom = GlobalFindAtomA(className)))
44 {
45 dprintf(("CreateWindowEx32A: bad class name "));
46 if (!HIWORD(className)) {
47 dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
48 }
49 else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
50 SetLastError(ERROR_INVALID_PARAMETER);
51 return 0;
52 }
53
54 /* Create the window */
55 cs.lpCreateParams = data;
56 cs.hInstance = instance;
57 cs.hMenu = menu;
58 cs.hwndParent = parent;
59 cs.x = x;
60 cs.y = y;
61 cs.cx = width;
62 cs.cy = height;
63 cs.style = style;
64 cs.lpszName = windowName;
65 cs.lpszClass = className;
66 cs.dwExStyle = exStyle;
67 dprintf(("CreateWindowExA: (%d,%d) (%d,%d), %x %x", x, y, width, height, style, exStyle));
68 window = new Win32Window( &cs, classAtom, FALSE );
69 if(window == NULL)
70 {
71 dprintf(("Win32Window creation failed!!"));
72 return 0;
73 }
74 if(GetLastError() != 0)
75 {
76 dprintf(("Win32Window error found!!"));
77 delete window;
78 return 0;
79 }
80 return window->getWindowHandle();
81}
82//******************************************************************************
83//******************************************************************************
84HWND WIN32API CreateMDIWindowA(LPCSTR arg1, LPCSTR arg2, DWORD arg3,
85 int arg4, int arg5, int arg6, int arg7,
86 HWND arg8, HINSTANCE arg9, LPARAM arg10)
87{
88 HWND hwnd;
89
90 dprintf(("USER32: CreateMDIWindowA\n"));
91
92 hwnd = O32_CreateMDIWindow((LPSTR)arg1, (LPSTR)arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
93
94 dprintf(("USER32: CreateMDIWindowA returned %X\n", hwnd));
95 return hwnd;
96}
97//******************************************************************************
98//******************************************************************************
99HWND WIN32API CreateMDIWindowW(LPCWSTR arg1, LPCWSTR arg2, DWORD arg3, int arg4,
100 int arg5, int arg6, int arg7, HWND arg8, HINSTANCE arg9,
101 LPARAM arg10)
102{
103 HWND hwnd;
104 char *astring1 = NULL, *astring2 = NULL;
105
106 if((int)arg1 >> 16 != 0) {
107 astring1 = UnicodeToAsciiString((LPWSTR)arg1);
108 }
109 else astring1 = (char *)arg2;
110
111 astring2 = UnicodeToAsciiString((LPWSTR)arg2);
112
113 hwnd = O32_CreateMDIWindow(astring1, astring2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
114
115 if(astring1) FreeAsciiString(astring1);
116 FreeAsciiString(astring2);
117 dprintf(("USER32: CreateMDIWindowW hwnd = %X\n", hwnd));
118 return(hwnd);
119}
120//******************************************************************************
121//******************************************************************************
122HWND WIN32API CreateWindowExW(DWORD exStyle, LPCWSTR className,
123 LPCWSTR windowName, DWORD style, INT x,
124 INT y, INT width, INT height,
125 HWND parent, HMENU menu,
126 HINSTANCE instance, LPVOID data )
127{
128 Win32Window *window;
129 ATOM classAtom;
130 CREATESTRUCTA cs;
131
132 if(exStyle & WS_EX_MDICHILD)
133 return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
134
135 /* Find the class atom */
136 if (!(classAtom = GlobalFindAtomW(className)))
137 {
138 dprintf(("CreateWindowEx32A: bad class name "));
139 if (!HIWORD(className)) {
140 dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
141 }
142// else dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
143 SetLastError(ERROR_INVALID_PARAMETER);
144 return 0;
145 }
146
147 /* Create the window */
148 cs.lpCreateParams = data;
149 cs.hInstance = instance;
150 cs.hMenu = menu;
151 cs.hwndParent = parent;
152 cs.x = x;
153 cs.y = y;
154 cs.cx = width;
155 cs.cy = height;
156 cs.style = style;
157 cs.lpszName = (LPSTR)windowName;
158 cs.lpszClass = (LPSTR)className;
159 cs.dwExStyle = exStyle;
160 window = new Win32Window( &cs, classAtom, TRUE );
161 if(window == NULL)
162 {
163 dprintf(("Win32Window creation failed!!"));
164 return 0;
165 }
166 if(GetLastError() != 0)
167 {
168 dprintf(("Win32Window error found!!"));
169 delete window;
170 return 0;
171 }
172 return window->getWindowHandle();
173}
174//******************************************************************************
175//******************************************************************************
176BOOL WIN32API DestroyWindow(HWND hwnd)
177{
178 Win32Window *window;
179
180 window = Win32Window::GetWindowFromHandle(hwnd);
181 if(!window) {
182 dprintf(("DestroyWindow, window %x not found", hwnd));
183 return 0;
184 }
185 dprintf(("DestroyWindow %x", hwnd));
186 return window->DestroyWindow();
187}
188//******************************************************************************
189//******************************************************************************
190HWND WIN32API SetActiveWindow( HWND hwnd)
191{
192 Win32Window *window;
193
194 window = Win32Window::GetWindowFromHandle(hwnd);
195 if(!window) {
196 dprintf(("SetActiveWindow, window %x not found", hwnd));
197 return 0;
198 }
199 dprintf(("SetActiveWindow %x", hwnd));
200 return window->SetActiveWindow();
201}
202//******************************************************************************
203//******************************************************************************
204HWND WIN32API GetParent( HWND hwnd)
205{
206 Win32Window *window;
207
208 window = Win32Window::GetWindowFromHandle(hwnd);
209 if(!window) {
210 dprintf(("GetParent, window %x not found", hwnd));
211 return 0;
212 }
213 dprintf(("GetParent %x", hwnd));
214 return window->GetParent();
215}
216//******************************************************************************
217//******************************************************************************
218HWND WIN32API SetParent( HWND hwndChild, HWND hwndNewParent)
219{
220 Win32Window *window;
221
222 window = Win32Window::GetWindowFromHandle(hwndChild);
223 if(!window) {
224 dprintf(("SetParent, window %x not found", hwndChild));
225 return 0;
226 }
227 dprintf(("SetParent %x %x", hwndChild, hwndNewParent));
228 return window->SetParent(hwndNewParent);
229}
230//******************************************************************************
231//******************************************************************************
232BOOL WIN32API IsChild( HWND hwndParent, HWND hwnd)
233{
234 Win32Window *window;
235
236 window = Win32Window::GetWindowFromHandle(hwnd);
237 if(!window) {
238 dprintf(("IsChild, window %x not found", hwnd));
239 return 0;
240 }
241 dprintf(("IsChild %x %x", hwndParent, hwnd));
242 return window->IsChild(hwndParent);
243}
244//******************************************************************************
245//******************************************************************************
246HWND WIN32API GetTopWindow( HWND hwnd)
247{
248 Win32Window *window;
249
250 window = Win32Window::GetWindowFromHandle(hwnd);
251 if(!window) {
252 dprintf(("GetTopWindow, window %x not found", hwnd));
253 return 0;
254 }
255 dprintf(("GetTopWindow %x", hwnd));
256 return window->GetTopWindow();
257}
258//******************************************************************************
259//******************************************************************************
260BOOL WIN32API UpdateWindow(HWND hwnd)
261{
262 Win32Window *window;
263
264 window = Win32Window::GetWindowFromHandle(hwnd);
265 if(!window) {
266 dprintf(("UpdateWindow, window %x not found", hwnd));
267 return 0;
268 }
269 dprintf(("UpdateWindow %x", hwnd));
270 return window->UpdateWindow();
271}
272//******************************************************************************
273//******************************************************************************
274BOOL WIN32API IsIconic( HWND hwnd)
275{
276 Win32Window *window;
277
278 window = Win32Window::GetWindowFromHandle(hwnd);
279 if(!window) {
280 dprintf(("IsIconic, window %x not found", hwnd));
281 return 0;
282 }
283 dprintf(("IsIconic %x", hwnd));
284 return window->IsIconic();
285}
286//******************************************************************************
287//******************************************************************************
288HWND WIN32API GetWindow(HWND hwnd, UINT uCmd)
289{
290 Win32Window *window;
291
292 window = Win32Window::GetWindowFromHandle(hwnd);
293 if(!window) {
294 dprintf(("GetWindow, window %x not found", hwnd));
295 return 0;
296 }
297 dprintf(("GetWindow %x %d", hwnd, uCmd));
298 return window->GetWindow(uCmd);
299}
300//******************************************************************************
301//******************************************************************************
302BOOL WIN32API EnableWindow( HWND hwnd, BOOL fEnable)
303{
304 Win32Window *window;
305
306 window = Win32Window::GetWindowFromHandle(hwnd);
307 if(!window) {
308 dprintf(("EnableWindow, window %x not found", hwnd));
309 return 0;
310 }
311 dprintf(("EnableWindow %x %d", hwnd, fEnable));
312 return window->EnableWindow(fEnable);
313}
314//******************************************************************************
315//******************************************************************************
316BOOL WIN32API BringWindowToTop(HWND hwnd)
317{
318 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
319}
320//******************************************************************************
321//******************************************************************************
322HWND WIN32API GetActiveWindow()
323{
324 return Win32Window::GetActiveWindow();
325}
326//******************************************************************************
327//******************************************************************************
328BOOL WIN32API ShowWindow(HWND hwnd, int nCmdShow)
329{
330 Win32Window *window;
331
332 window = Win32Window::GetWindowFromHandle(hwnd);
333 if(!window) {
334 dprintf(("ShowWindow, window %x not found", hwnd));
335 return 0;
336 }
337 dprintf(("ShowWindow %x", hwnd));
338 return window->ShowWindow(nCmdShow);
339}
340//******************************************************************************
341//******************************************************************************
342BOOL WIN32API SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
343{
344 Win32Window *window;
345
346 window = Win32Window::GetWindowFromHandle(hwnd);
347 if(!window) {
348 dprintf(("SetWindowPos, window %x not found", hwnd));
349 return 0;
350 }
351 dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
352 return window->SetWindowPos(hwndInsertAfter, x, y, cx, cy, fuFlags);
353}
354//******************************************************************************
355//******************************************************************************
356BOOL WIN32API SetWindowPlacement( HWND arg1, const WINDOWPLACEMENT * arg2)
357{
358 dprintf(("USER32: SetWindowPlacement\n"));
359 return O32_SetWindowPlacement(arg1, arg2);
360}
361//******************************************************************************
362//******************************************************************************
363BOOL WIN32API GetWindowPlacement( HWND arg1, LPWINDOWPLACEMENT arg2)
364{
365#ifdef DEBUG
366 WriteLog("USER32: GetWindowPlacement\n");
367#endif
368 return O32_GetWindowPlacement(arg1, arg2);
369}
370//******************************************************************************
371//******************************************************************************
372BOOL WIN32API IsWindow( HWND hwnd)
373{
374 Win32Window *window;
375
376 window = Win32Window::GetWindowFromHandle(hwnd);
377 if(!window) {
378 dprintf(("IsWindow, window %x not found", hwnd));
379 return FALSE;
380 }
381 dprintf(("IsWindow %x", hwnd));
382 return window->IsWindow();
383}
384//******************************************************************************
385//******************************************************************************
386BOOL WIN32API IsWindowEnabled( HWND hwnd)
387{
388 Win32Window *window;
389
390 window = Win32Window::GetWindowFromHandle(hwnd);
391 if(!window) {
392 dprintf(("IsWindowEnabled, window %x not found", hwnd));
393 return 0;
394 }
395 dprintf(("IsWindowEnabled %x", hwnd));
396 return window->IsWindowEnabled();
397}
398//******************************************************************************
399//******************************************************************************
400BOOL WIN32API IsWindowVisible( HWND hwnd)
401{
402 Win32Window *window;
403
404 window = Win32Window::GetWindowFromHandle(hwnd);
405 if(!window) {
406 dprintf(("IsWindowVisible, window %x not found", hwnd));
407 return 0;
408 }
409 dprintf(("IsWindowVisible %x", hwnd));
410 return window->IsWindowVisible();
411}
412//******************************************************************************
413//******************************************************************************
414HWND WIN32API SetFocus( HWND hwnd)
415{
416 HWND lastFocus;
417
418 dprintf(("USER32: SetFocus\n"));
419
420 lastFocus = GetFocus();
421 hwnd = Win32Window::Win32ToOS2Handle(hwnd);
422 return (OSLibWinSetFocus(OSLIB_HWND_DESKTOP,hwnd)) ? lastFocus:0;
423}
424//******************************************************************************
425//******************************************************************************
426HWND WIN32API GetFocus(void)
427{
428 HWND hwnd;
429// dprintf(("USER32: GetFocus\n"));
430
431 hwnd = OSLibWinQueryFocus(OSLIB_HWND_DESKTOP);
432 return Win32Window::OS2ToWin32Handle(hwnd);
433}
434//******************************************************************************
435//******************************************************************************
436/***********************************************************************
437 * GetInternalWindowPos (USER32.245)
438 */
439UINT WIN32API GetInternalWindowPos(HWND hwnd,
440 LPRECT rectWnd,
441 LPPOINT ptIcon )
442{
443 WINDOWPLACEMENT wndpl;
444
445 dprintf(("USER32: GetInternalWindowPos(%08xh,%08xh,%08xh)\n",
446 hwnd,
447 rectWnd,
448 ptIcon));
449
450 if (GetWindowPlacement( hwnd, &wndpl ))
451 {
452 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
453 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
454 return wndpl.showCmd;
455 }
456 return 0;
457}
458//******************************************************************************
459//******************************************************************************
460BOOL WIN32API IsZoomed( HWND arg1)
461{
462#ifdef DEBUG
463 WriteLog("USER32: IsZoomed\n");
464#endif
465 return O32_IsZoomed(arg1);
466}
467//******************************************************************************
468//******************************************************************************
469BOOL WIN32API LockWindowUpdate( HWND arg1)
470{
471#ifdef DEBUG
472 WriteLog("USER32: LockWindowUpdate\n");
473#endif
474 return O32_LockWindowUpdate(arg1);
475}
476//******************************************************************************
477//******************************************************************************
478BOOL WIN32API RedrawWindow( HWND arg1, const RECT * arg2, HRGN arg3, UINT arg4)
479{
480 BOOL rc;
481
482 rc = O32_RedrawWindow(arg1, arg2, arg3, arg4);
483#ifdef DEBUG
484 WriteLog("USER32: RedrawWindow %X , %X, %X, %X returned %d\n", arg1, arg2, arg3, arg4, rc);
485#endif
486 InvalidateRect(arg1, arg2, TRUE);
487 UpdateWindow(arg1);
488 SendMessageA(arg1, WM_PAINT, 0, 0);
489 return(rc);
490}
491//******************************************************************************
492//******************************************************************************
493BOOL WIN32API GetWindowRect( HWND hwnd, PRECT pRect)
494{
495 Win32Window *window;
496
497 window = Win32Window::GetWindowFromHandle(hwnd);
498 if(!window) {
499 dprintf(("GetWindowRect, window %x not found", hwnd));
500 return 0;
501 }
502 dprintf(("GetWindowRect %x", hwnd));
503 return window->GetWindowRect(pRect);
504}
505//******************************************************************************
506//******************************************************************************
507int WIN32API GetWindowTextLengthA( HWND hwnd)
508{
509 Win32Window *window;
510
511 window = Win32Window::GetWindowFromHandle(hwnd);
512 if(!window) {
513 dprintf(("GetWindowTextLength, window %x not found", hwnd));
514 return 0;
515 }
516 dprintf(("GetWindowTextLength %x", hwnd));
517 return window->GetWindowTextLengthA();
518}
519//******************************************************************************
520//******************************************************************************
521int WIN32API GetWindowTextA( HWND hwnd, LPSTR lpsz, int cch)
522{
523 Win32Window *window;
524
525 window = Win32Window::GetWindowFromHandle(hwnd);
526 if(!window) {
527 dprintf(("GetWindowTextA, window %x not found", hwnd));
528 return 0;
529 }
530 dprintf(("GetWindowTextA %x", hwnd));
531 return window->GetWindowTextA(lpsz, cch);
532}
533//******************************************************************************
534//******************************************************************************
535int WIN32API GetWindowTextLengthW( HWND hwnd)
536{
537 dprintf(("USER32: GetWindowTextLengthW\n"));
538 return GetWindowTextLengthA(hwnd);
539}
540//******************************************************************************
541//******************************************************************************
542int WIN32API GetWindowTextW(HWND hwnd, LPWSTR lpsz, int cch)
543{
544 char title[128];
545 int rc;
546
547 rc = O32_GetWindowText(hwnd, title, sizeof(title));
548#ifdef DEBUG
549 WriteLog("USER32: GetWindowTextW returned %s\n", title);
550#endif
551 if(rc > cch) {
552 title[cch-1] = 0;
553 rc = cch;
554 }
555 AsciiToUnicode(title, lpsz);
556 return(rc);
557}
558//******************************************************************************
559//******************************************************************************
560BOOL WIN32API SetWindowTextA(HWND hwnd, LPCSTR lpsz)
561{
562 Win32Window *window;
563
564 window = Win32Window::GetWindowFromHandle(hwnd);
565 if(!window) {
566 dprintf(("SetWindowTextA, window %x not found", hwnd));
567 return 0;
568 }
569 dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
570 return window->SetWindowText((LPSTR)lpsz);
571}
572//******************************************************************************
573//******************************************************************************
574BOOL WIN32API SetWindowTextW( HWND arg1, LPCWSTR arg2)
575{
576 char *astring = UnicodeToAsciiString((LPWSTR)arg2);
577 BOOL rc;
578
579 rc = SetWindowTextA(arg1, (LPCSTR)astring);
580 dprintf(("USER32: SetWindowTextW %X %s returned %d\n", arg1, astring, rc));
581 FreeAsciiString(astring);
582 return(rc);
583}
584/*******************************************************************
585 * InternalGetWindowText (USER32.326)
586 */
587int WIN32API InternalGetWindowText(HWND hwnd,
588 LPWSTR lpString,
589 INT nMaxCount )
590{
591 dprintf(("USER32: InternalGetWindowText(%08xh,%08xh,%08xh) not properly implemented.\n",
592 hwnd,
593 lpString,
594 nMaxCount));
595
596 return GetWindowTextW(hwnd,lpString,nMaxCount);
597}
598//******************************************************************************
599//TODO: Correct?
600//******************************************************************************
601BOOL WIN32API SetForegroundWindow(HWND hwnd)
602{
603 dprintf((" SetForegroundWindow %x", hwnd));
604
605 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
606}
607//******************************************************************************
608//******************************************************************************
609BOOL WIN32API GetClientRect( HWND hwnd, PRECT pRect)
610{
611 BOOL rc;
612
613 hwnd = Win32Window::Win32ToOS2Handle(hwnd);
614 rc = OSLibWinQueryWindowRect(hwnd, pRect);
615 dprintf(("USER32: GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
616 return rc;
617}
618//******************************************************************************
619//******************************************************************************
620BOOL WIN32API AdjustWindowRect( PRECT arg1, DWORD arg2, BOOL arg3)
621{
622#ifdef DEBUG
623 WriteLog("USER32: AdjustWindowRect\n");
624#endif
625 return O32_AdjustWindowRect(arg1, arg2, arg3);
626}
627//******************************************************************************
628//******************************************************************************
629BOOL WIN32API AdjustWindowRectEx( PRECT arg1, DWORD arg2, BOOL arg3, DWORD arg4)
630{
631#ifdef DEBUG
632 WriteLog("USER32: AdjustWindowRectEx\n");
633#endif
634 return O32_AdjustWindowRectEx(arg1, arg2, arg3, arg4);
635}
636//******************************************************************************
637//******************************************************************************
638HWND WIN32API GetDesktopWindow(void)
639{
640 dprintf(("USER32: GetDesktopWindow\n"));
641 return OSLIB_HWND_DESKTOP;
642}
643//******************************************************************************
644//******************************************************************************
645HWND WIN32API FindWindowA(LPCSTR lpszClass, LPCSTR lpszWindow)
646{
647 if(!lpszClass) {
648 SetLastError(ERROR_INVALID_PARAMETER);
649 return 0;
650 }
651 if(HIWORD(lpszClass)) {
652 dprintf(("USER32: FindWindow %s %s\n", lpszClass, lpszWindow));
653 }
654 else dprintf(("USER32: FindWindow %x %s\n", lpszClass, lpszWindow));
655
656 return Win32Window::FindWindowEx(OSLIB_HWND_DESKTOP, 0, (LPSTR)lpszClass, (LPSTR)lpszWindow);
657}
658//******************************************************************************
659//******************************************************************************
660HWND WIN32API FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
661{
662 if(!lpszClass) {
663 SetLastError(ERROR_INVALID_PARAMETER);
664 return 0;
665 }
666 if(HIWORD(lpszClass)) {
667 dprintf(("USER32: FindWindowExA (%x,%x) %s %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
668 }
669 else dprintf(("USER32: FindWindowExA (%x,%x)%x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
670
671 return Win32Window::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
672}
673/*****************************************************************************
674 * Name : HWND WIN32API FindWindowExW
675 * Purpose : The FindWindowEx function retrieves the handle of a window whose
676 * class name and window name match the specified strings. The
677 * function searches child windows, beginning with the one following
678 * the given child window.
679 * Parameters: HWND hwndParent handle of parent window
680 * HWND hwndChildAfter handle of a child window
681 * LPCTSTR lpszClass address of class name
682 * LPCTSTR lpszWindow address of window name
683 * Variables :
684 * Result : If the function succeeds, the return value is the handle of the
685 * window that has the specified class and window names.
686 * If the function fails, the return value is NULL. To get extended
687 * error information, call GetLastError.
688 * Remark :
689 * Status : UNTESTED STUB
690 *
691 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
692 *****************************************************************************/
693
694HWND WIN32API FindWindowExW(HWND hwndParent,
695 HWND hwndChildAfter,
696 LPCWSTR lpszClass,
697 LPCWSTR lpszWindow)
698{
699 if(!lpszClass) {
700 SetLastError(ERROR_INVALID_PARAMETER);
701 return 0;
702 }
703 dprintf(("USER32: FindWindowExW (%x,%x) %x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
704
705 return Win32Window::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
706}
707//******************************************************************************
708//******************************************************************************
709BOOL WIN32API FlashWindow(HWND hwnd, BOOL fFlash)
710{
711 dprintf(("FlashWindow %x %d\n", hwnd, fFlash));
712 return OSLibWinFlashWindow(Win32Window::Win32ToOS2Handle(hwnd), fFlash);
713}
714//******************************************************************************
715//******************************************************************************
716BOOL WIN32API MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
717 BOOL repaint )
718{
719 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
720
721 if (!repaint) flags |= SWP_NOREDRAW;
722 dprintf(("MoveWindow: %04x %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint ));
723
724 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
725}
726//******************************************************************************
727//******************************************************************************
728BOOL WIN32API ClientToScreen( HWND arg1, PPOINT arg2)
729{
730#ifdef DEBUG
731//// WriteLog("USER32: ClientToScreen\n");
732#endif
733 return O32_ClientToScreen(arg1, arg2);
734}
735//******************************************************************************
736//******************************************************************************
737HDWP WIN32API BeginDeferWindowPos( int arg1)
738{
739#ifdef DEBUG
740 WriteLog("USER32: BeginDeferWindowPos\n");
741#endif
742 return O32_BeginDeferWindowPos(arg1);
743}
744//******************************************************************************
745//******************************************************************************
746HDWP WIN32API DeferWindowPos( HDWP arg1, HWND arg2, HWND arg3, int arg4, int arg5, int arg6, int arg7, UINT arg8)
747{
748#ifdef DEBUG
749 WriteLog("USER32: DeferWindowPos\n");
750#endif
751 return O32_DeferWindowPos(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
752}
753//******************************************************************************
754//******************************************************************************
755HWND WIN32API ChildWindowFromPoint( HWND arg1, POINT arg2)
756{
757#ifdef DEBUG
758 WriteLog("USER32: ChildWindowFromPoint\n");
759#endif
760 return O32_ChildWindowFromPoint(arg1, arg2);
761}
762//******************************************************************************
763//******************************************************************************
764HWND WIN32API ChildWindowFromPointEx(HWND arg1, POINT arg2, UINT uFlags)
765{
766#ifdef DEBUG
767 WriteLog("USER32: ChildWindowFromPointEx, not completely supported!\n");
768#endif
769 return O32_ChildWindowFromPoint(arg1, arg2);
770}
771//******************************************************************************
772//******************************************************************************
773BOOL WIN32API CloseWindow(HWND hwnd)
774{
775 Win32Window *window;
776
777 window = Win32Window::GetWindowFromHandle(hwnd);
778 if(!window) {
779 dprintf(("CloseWindow, window %x not found", hwnd));
780 return 0;
781 }
782 dprintf(("CloseWindow %x\n", hwnd));
783 return window->CloseWindow();
784}
785//******************************************************************************
786//TODO: Does this return handles of hidden or disabled windows?
787//******************************************************************************
788HWND WIN32API WindowFromPoint( POINT point)
789{
790 HWND hwnd;
791
792 dprintf(("WindowFromPoint (%d,%d)\n", point.x, point.y));
793 hwnd = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&point);
794 if(hwnd) {
795 return Win32Window::OS2ToWin32Handle(hwnd);
796 }
797 return 0;
798}
799//******************************************************************************
800//******************************************************************************
801BOOL WIN32API IsWindowUnicode(HWND hwnd)
802{
803 Win32Window *window;
804
805 window = Win32Window::GetWindowFromHandle(hwnd);
806 if(!window) {
807 dprintf(("IsWindowUnicode, window %x not found", hwnd));
808 return 0;
809 }
810 return window->IsUnicode();
811}
812/*****************************************************************************
813 * Name : WORD WIN32API CascadeWindows
814 * Purpose : The CascadeWindows function cascades the specified windows or
815 * the child windows of the specified parent window.
816 * Parameters: HWND hwndParent handle of parent window
817 * UINT wHow types of windows not to arrange
818 * CONST RECT * lpRect rectangle to arrange windows in
819 * UINT cKids number of windows to arrange
820 * const HWND FAR * lpKids array of window handles
821 * Variables :
822 * Result : If the function succeeds, the return value is the number of windows arranged.
823 * If the function fails, the return value is zero.
824 * Remark :
825 * Status : UNTESTED STUB
826 *
827 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
828 *****************************************************************************/
829
830WORD WIN32API CascadeWindows(HWND hwndParent,
831 UINT wHow,
832 CONST LPRECT lpRect,
833 UINT cKids,
834 const HWND *lpKids)
835{
836 dprintf(("USER32:CascadeWindows(%08xh,%u,%08xh,%u,%08x) not implemented.\n",
837 hwndParent,
838 wHow,
839 lpRect,
840 cKids,
841 lpKids));
842
843 return (0);
844}
845/*****************************************************************************
846 * Name : BOOL WIN32API SwitchToThisWindow
847 * Purpose : Unknown
848 * Parameters: Unknown
849 * Variables :
850 * Result :
851 * Remark :
852 * Status : UNTESTED UNKNOWN STUB
853 *
854 * Author : Patrick Haller [Wed, 1998/06/16 11:55]
855 *****************************************************************************/
856
857BOOL WIN32API SwitchToThisWindow(HWND hwnd,
858 BOOL x2)
859{
860 dprintf(("USER32: SwitchToThisWindow(%08xh,%08xh) not implemented.\n",
861 hwnd,
862 x2));
863
864 return (FALSE); /* default */
865}
866//******************************************************************************
867//******************************************************************************
868BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
869{
870 BOOL rc;
871 EnumWindowCallback *callback = new EnumWindowCallback(lpfn, lParam);
872
873 dprintf(("USER32: EnumThreadWindows\n"));
874 //CB: replace
875 rc = O32_EnumThreadWindows(dwThreadId, callback->GetOS2Callback(), (LPARAM)callback);
876 if(callback)
877 delete callback;
878 return(rc);
879}
880//******************************************************************************
881//******************************************************************************
882BOOL WIN32API GetUpdateRect( HWND hwnd, PRECT lpRect, BOOL bErase)
883{
884 dprintf(("GetUpdateRect %x %d\n", hwnd, bErase));
885 if (!lpRect) return FALSE;
886
887 return OSLibWinQueryUpdateRect(Win32Window::Win32ToOS2Handle(hwnd), lpRect);
888}
889//******************************************************************************
890//******************************************************************************
891BOOL WIN32API InvalidateRect(HWND hWnd, const RECT *lpRect, BOOL bErase)
892{
893#ifdef DEBUG
894 if(lpRect)
895 WriteLog("USER32: InvalidateRect for window %X (%d,%d)(%d,%d) %d\n", hWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase);
896 else WriteLog("USER32: InvalidateRect for window %X NULL, %d\n", hWnd, bErase);
897#endif
898
899 //CB: bErase no quite the same
900 hWnd = Win32Window::Win32ToOS2Handle(hWnd);
901 if (lpRect)
902 {
903 return OSLibWinInvalidateRect(hWnd, (PRECT)lpRect, bErase);
904 }
905 else return OSLibWinInvalidateRect(hWnd,NULL,bErase);
906}
907//******************************************************************************
908//******************************************************************************
909UINT WIN32API ArrangeIconicWindows( HWND arg1)
910{
911#ifdef DEBUG
912 WriteLog("USER32: ArrangeIconicWindows\n");
913#endif
914 return O32_ArrangeIconicWindows(arg1);
915}
916//******************************************************************************
917//restores iconized window to previous size/position
918//******************************************************************************
919BOOL WIN32API OpenIcon(HWND hwnd)
920{
921#ifdef DEBUG
922 WriteLog("USER32: OpenIcon\n");
923#endif
924 if(!IsIconic(hwnd))
925 return FALSE;
926 ShowWindow(hwnd, SW_SHOWNORMAL);
927 return TRUE;
928}
929//******************************************************************************
930//******************************************************************************
931BOOL WIN32API ShowOwnedPopups( HWND arg1, BOOL arg2)
932{
933 dprintf(("USER32: ShowOwnedPopups\n"));
934 return O32_ShowOwnedPopups(arg1, arg2);
935}
936//******************************************************************************
937//******************************************************************************
Note: See TracBrowser for help on using the repository browser.