Removed import of x11drv from ddraw.
[wine/dcerpc.git] / windows / winpos.c
blob8b36e61d64679ab170bf67f8e9f761ee74a10e44
1 /*
2 * Window position related functions.
4 * Copyright 1993, 1994, 1995 Alexandre Julliard
5 * 1995, 1996, 1999 Alex Korobka
6 */
8 #include <string.h>
9 #include "winerror.h"
10 #include "windef.h"
11 #include "wingdi.h"
12 #include "winerror.h"
13 #include "wine/winuser16.h"
14 #include "controls.h"
15 #include "user.h"
16 #include "region.h"
17 #include "win.h"
18 #include "hook.h"
19 #include "message.h"
20 #include "queue.h"
21 #include "winpos.h"
22 #include "dce.h"
23 #include "nonclient.h"
24 #include "debugtools.h"
25 #include "input.h"
27 DEFAULT_DEBUG_CHANNEL(win);
29 #define HAS_DLGFRAME(style,exStyle) \
30 (((exStyle) & WS_EX_DLGMODALFRAME) || \
31 (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
33 #define HAS_THICKFRAME(style) \
34 (((style) & WS_THICKFRAME) && \
35 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
37 #define EMPTYPOINT(pt) ((*(LONG*)&(pt)) == -1)
39 #define PLACE_MIN 0x0001
40 #define PLACE_MAX 0x0002
41 #define PLACE_RECT 0x0004
44 #define DWP_MAGIC ((INT)('W' | ('P' << 8) | ('O' << 16) | ('S' << 24)))
46 typedef struct
48 INT actualCount;
49 INT suggestedCount;
50 BOOL valid;
51 INT wMagic;
52 HWND hwndParent;
53 WINDOWPOS winPos[1];
54 } DWP;
56 /* ----- internal variables ----- */
58 static HWND hwndPrevActive = 0; /* Previously active window */
59 static HWND hGlobalShellWindow=0; /*the shell*/
60 static HWND hGlobalTaskmanWindow=0;
61 static HWND hGlobalProgmanWindow=0;
63 static LPCSTR atomInternalPos;
65 extern HQUEUE16 hActiveQueue;
67 /***********************************************************************
68 * WINPOS_CreateInternalPosAtom
70 BOOL WINPOS_CreateInternalPosAtom()
72 LPSTR str = "SysIP";
73 atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str);
74 return (atomInternalPos) ? TRUE : FALSE;
77 /***********************************************************************
78 * WINPOS_CheckInternalPos
80 * Called when a window is destroyed.
82 void WINPOS_CheckInternalPos( WND* wndPtr )
84 LPINTERNALPOS lpPos;
85 MESSAGEQUEUE *pMsgQ = 0;
86 HWND hwnd = wndPtr->hwndSelf;
88 lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
90 /* Retrieve the message queue associated with this window */
91 pMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( wndPtr->hmemTaskQ );
92 if ( !pMsgQ )
94 WARN("\tMessage queue not found. Exiting!\n" );
95 return;
98 if( hwnd == hwndPrevActive ) hwndPrevActive = 0;
100 if( hwnd == PERQDATA_GetActiveWnd( pMsgQ->pQData ) )
102 PERQDATA_SetActiveWnd( pMsgQ->pQData, 0 );
103 WARN("\tattempt to activate destroyed window!\n");
106 if( lpPos )
108 if( IsWindow(lpPos->hwndIconTitle) )
109 DestroyWindow( lpPos->hwndIconTitle );
110 HeapFree( GetProcessHeap(), 0, lpPos );
113 QUEUE_Unlock( pMsgQ );
114 return;
117 /***********************************************************************
118 * ArrangeIconicWindows (USER.170)
120 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
122 return ArrangeIconicWindows(parent);
124 /***********************************************************************
125 * ArrangeIconicWindows (USER32.@)
127 UINT WINAPI ArrangeIconicWindows( HWND parent )
129 RECT rectParent;
130 HWND hwndChild;
131 INT x, y, xspacing, yspacing;
133 GetClientRect( parent, &rectParent );
134 x = rectParent.left;
135 y = rectParent.bottom;
136 xspacing = GetSystemMetrics(SM_CXICONSPACING);
137 yspacing = GetSystemMetrics(SM_CYICONSPACING);
139 hwndChild = GetWindow( parent, GW_CHILD );
140 while (hwndChild)
142 if( IsIconic( hwndChild ) )
144 WND *wndPtr = WIN_FindWndPtr(hwndChild);
146 WINPOS_ShowIconTitle( wndPtr, FALSE );
148 SetWindowPos( hwndChild, 0, x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
149 y - yspacing - GetSystemMetrics(SM_CYICON)/2, 0, 0,
150 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
151 if( IsWindow(hwndChild) )
152 WINPOS_ShowIconTitle(wndPtr , TRUE );
153 WIN_ReleaseWndPtr(wndPtr);
155 if (x <= rectParent.right - xspacing) x += xspacing;
156 else
158 x = rectParent.left;
159 y -= yspacing;
162 hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
164 return yspacing;
168 /***********************************************************************
169 * SwitchToThisWindow (USER.172)
171 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
173 SwitchToThisWindow( hwnd, restore );
177 /***********************************************************************
178 * SwitchToThisWindow (USER32.@)
180 void WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
182 ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
186 /***********************************************************************
187 * GetWindowRect (USER.32)
189 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
191 WND * wndPtr = WIN_FindWndPtr( hwnd );
192 if (!wndPtr) return;
194 CONV_RECT32TO16( &wndPtr->rectWindow, rect );
195 if (wndPtr->parent)
196 MapWindowPoints16( wndPtr->parent->hwndSelf, 0, (POINT16 *)rect, 2 );
197 WIN_ReleaseWndPtr(wndPtr);
201 /***********************************************************************
202 * GetWindowRect (USER32.@)
204 BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
206 WND * wndPtr = WIN_FindWndPtr( hwnd );
207 if (!wndPtr) return FALSE;
209 *rect = wndPtr->rectWindow;
210 if (wndPtr->parent)
211 MapWindowPoints( wndPtr->parent->hwndSelf, 0, (POINT *)rect, 2 );
212 WIN_ReleaseWndPtr(wndPtr);
213 TRACE("hwnd %04x (%d,%d)-(%d,%d)\n",
214 hwnd, rect->left, rect->top, rect->right, rect->bottom);
215 return TRUE;
219 /***********************************************************************
220 * GetWindowRgn (USER32.@)
222 int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
224 int nRet = ERROR;
225 WND *wndPtr = WIN_FindWndPtr( hwnd );
226 if (wndPtr)
228 if (wndPtr->hrgnWnd) nRet = CombineRgn( hrgn, wndPtr->hrgnWnd, 0, RGN_COPY );
229 WIN_ReleaseWndPtr(wndPtr);
231 return nRet;
234 /***********************************************************************
235 * SetWindowRgn (USER32.@)
237 int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
239 RECT rect;
240 WND *wndPtr;
241 int ret = FALSE;
243 if (USER_Driver.pSetWindowRgn)
244 return USER_Driver.pSetWindowRgn( hwnd, hrgn, bRedraw );
246 if (!(wndPtr = WIN_FindWndPtr(hwnd))) return FALSE;
248 if (wndPtr->hrgnWnd == hrgn)
250 ret = TRUE;
251 goto done;
254 if (hrgn) /* verify that region really exists */
256 if (GetRgnBox( hrgn, &rect ) == ERROR) goto done;
259 if (wndPtr->hrgnWnd)
261 /* delete previous region */
262 DeleteObject(wndPtr->hrgnWnd);
263 wndPtr->hrgnWnd = 0;
265 wndPtr->hrgnWnd = hrgn;
267 /* Size the window to the rectangle of the new region (if it isn't NULL) */
268 if (hrgn) SetWindowPos( hwnd, 0, rect.left, rect.top,
269 rect.right - rect.left, rect.bottom - rect.top,
270 SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOACTIVATE |
271 SWP_NOZORDER | (bRedraw ? 0 : SWP_NOREDRAW) );
272 ret = TRUE;
274 done:
275 WIN_ReleaseWndPtr(wndPtr);
276 return ret;
279 /***********************************************************************
280 * SetWindowRgn (USER.668)
282 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn,BOOL16 bRedraw)
286 FIXME("SetWindowRgn16: stub\n");
287 return TRUE;
291 /***********************************************************************
292 * GetClientRect (USER.33)
294 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
296 WND * wndPtr = WIN_FindWndPtr( hwnd );
298 rect->left = rect->top = rect->right = rect->bottom = 0;
299 if (wndPtr)
301 rect->right = wndPtr->rectClient.right - wndPtr->rectClient.left;
302 rect->bottom = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
304 WIN_ReleaseWndPtr(wndPtr);
308 /***********************************************************************
309 * GetClientRect (USER32.@)
311 BOOL WINAPI GetClientRect( HWND hwnd, LPRECT rect )
313 WND * wndPtr = WIN_FindWndPtr( hwnd );
315 rect->left = rect->top = rect->right = rect->bottom = 0;
316 if (!wndPtr) return FALSE;
317 rect->right = wndPtr->rectClient.right - wndPtr->rectClient.left;
318 rect->bottom = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
320 WIN_ReleaseWndPtr(wndPtr);
321 TRACE("hwnd %04x (%d,%d)-(%d,%d)\n",
322 hwnd, rect->left, rect->top, rect->right, rect->bottom);
323 return TRUE;
327 /*******************************************************************
328 * ClientToScreen (USER.28)
330 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
332 MapWindowPoints16( hwnd, 0, lppnt, 1 );
336 /*******************************************************************
337 * ClientToScreen (USER32.@)
339 BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
341 MapWindowPoints( hwnd, 0, lppnt, 1 );
342 return TRUE;
346 /*******************************************************************
347 * ScreenToClient (USER.29)
349 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
351 MapWindowPoints16( 0, hwnd, lppnt, 1 );
355 /*******************************************************************
356 * ScreenToClient (USER32.@)
358 BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
360 MapWindowPoints( 0, hwnd, lppnt, 1 );
361 return TRUE;
365 /***********************************************************************
366 * WINPOS_WindowFromPoint
368 * Find the window and hittest for a given point.
370 HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest )
372 WND *wndScope, *wndPtr, *wndTmp;
373 HWND hwnd_ret = 0;
374 POINT xy = pt;
376 TRACE("scope %04x %ld,%ld\n", hwndScope, pt.x, pt.y);
378 if (!hwndScope) hwndScope = GetDesktopWindow();
379 if (!(wndScope = WIN_FindWndPtr( hwndScope ))) return 0;
381 *hittest = HTERROR;
382 wndPtr = WIN_LockWndPtr(wndScope->child);
384 if( wndScope->dwStyle & WS_DISABLED )
386 *hittest = HTERROR;
387 goto end;
390 if (wndScope->parent)
391 MapWindowPoints( GetDesktopWindow(), wndScope->parent->hwndSelf, &xy, 1 );
393 if (xy.x < wndScope->rectClient.left || pt.x >= wndScope->rectClient.right ||
394 xy.y < wndScope->rectClient.top || pt.y >= wndScope->rectClient.bottom ||
395 wndScope->dwStyle & WS_MINIMIZE)
396 goto hittest;
398 xy.x -= wndScope->rectClient.left;
399 xy.y -= wndScope->rectClient.top;
401 for (;;)
403 while (wndPtr)
405 /* If point is in window, and window is visible, and it */
406 /* is enabled (or it's a top-level window), then explore */
407 /* its children. Otherwise, go to the next window. */
409 if ((wndPtr->dwStyle & WS_VISIBLE) &&
410 ((wndPtr->dwExStyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) != (WS_EX_LAYERED | WS_EX_TRANSPARENT)) &&
411 (!(wndPtr->dwStyle & WS_DISABLED) ||
412 ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)) &&
413 (wndPtr->hrgnWnd ?
414 PtInRegion(wndPtr->hrgnWnd, xy.x - wndPtr->rectWindow.left,
415 xy.y - wndPtr->rectWindow.top) :
416 ((xy.x >= wndPtr->rectWindow.left) &&
417 (xy.x < wndPtr->rectWindow.right) &&
418 (xy.y >= wndPtr->rectWindow.top) &&
419 (xy.y < wndPtr->rectWindow.bottom))))
421 TRACE("%ld,%ld is inside %04x\n", xy.x, xy.y, wndPtr->hwndSelf);
422 hwnd_ret = wndPtr->hwndSelf; /* Got a suitable window */
424 /* If window is minimized or disabled, return at once */
425 if (wndPtr->dwStyle & WS_MINIMIZE)
427 *hittest = HTCAPTION;
428 goto end;
430 if (wndPtr->dwStyle & WS_DISABLED)
432 *hittest = HTERROR;
433 goto end;
436 /* If point is not in client area, ignore the children */
437 if ((xy.x < wndPtr->rectClient.left) ||
438 (xy.x >= wndPtr->rectClient.right) ||
439 (xy.y < wndPtr->rectClient.top) ||
440 (xy.y >= wndPtr->rectClient.bottom)) break;
442 xy.x -= wndPtr->rectClient.left;
443 xy.y -= wndPtr->rectClient.top;
444 WIN_UpdateWndPtr(&wndPtr,wndPtr->child);
446 else
448 WIN_UpdateWndPtr(&wndPtr,wndPtr->next);
452 hittest:
453 /* If nothing found, try the scope window */
454 if (!hwnd_ret) hwnd_ret = hwndScope;
456 /* Send the WM_NCHITTEST message (only if to the same task) */
457 if (GetWindowThreadProcessId( hwnd_ret, NULL ) == GetCurrentThreadId())
459 INT res = SendMessageA( hwnd_ret, WM_NCHITTEST, 0, MAKELONG( pt.x, pt.y ) );
460 if (res != HTTRANSPARENT)
462 *hittest = res; /* Found the window */
463 goto end;
466 else
468 *hittest = HTCLIENT;
469 goto end;
472 if (!(wndTmp = WIN_FindWndPtr( hwnd_ret ))) break;
474 /* If no children found in last search, make point relative to parent */
475 if (!wndPtr)
477 xy.x += wndTmp->rectClient.left;
478 xy.y += wndTmp->rectClient.top;
481 /* Restart the search from the next sibling */
482 WIN_UpdateWndPtr(&wndPtr,wndTmp->next);
483 hwnd_ret = wndTmp->parent ? wndTmp->parent->hwndSelf : 0;
484 WIN_ReleaseWndPtr( wndTmp );
487 end:
488 WIN_ReleaseWndPtr(wndPtr);
489 WIN_ReleaseWndPtr(wndScope);
490 return hwnd_ret;
494 /*******************************************************************
495 * WindowFromPoint (USER.30)
497 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
499 POINT pt32;
501 CONV_POINT16TO32( &pt, &pt32 );
502 return WindowFromPoint( pt32 );
506 /*******************************************************************
507 * WindowFromPoint (USER32.@)
509 HWND WINAPI WindowFromPoint( POINT pt )
511 INT hittest;
512 return WINPOS_WindowFromPoint( 0, pt, &hittest );
516 /*******************************************************************
517 * ChildWindowFromPoint (USER.191)
519 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
521 POINT pt32;
522 CONV_POINT16TO32( &pt, &pt32 );
523 return (HWND16)ChildWindowFromPoint( hwndParent, pt32 );
527 /*******************************************************************
528 * ChildWindowFromPoint (USER32.@)
530 HWND WINAPI ChildWindowFromPoint( HWND hwndParent, POINT pt )
532 /* pt is in the client coordinates */
534 WND* wnd = WIN_FindWndPtr(hwndParent);
535 RECT rect;
536 HWND retvalue;
538 if( !wnd ) return 0;
540 /* get client rect fast */
541 rect.top = rect.left = 0;
542 rect.right = wnd->rectClient.right - wnd->rectClient.left;
543 rect.bottom = wnd->rectClient.bottom - wnd->rectClient.top;
545 if (!PtInRect( &rect, pt ))
547 retvalue = 0;
548 goto end;
550 WIN_UpdateWndPtr(&wnd,wnd->child);
551 while ( wnd )
553 if (PtInRect( &wnd->rectWindow, pt ))
555 retvalue = wnd->hwndSelf;
556 goto end;
558 WIN_UpdateWndPtr(&wnd,wnd->next);
560 retvalue = hwndParent;
561 end:
562 WIN_ReleaseWndPtr(wnd);
563 return retvalue;
566 /*******************************************************************
567 * ChildWindowFromPointEx (USER.399)
569 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
571 POINT pt32;
572 CONV_POINT16TO32( &pt, &pt32 );
573 return (HWND16)ChildWindowFromPointEx( hwndParent, pt32, uFlags );
577 /*******************************************************************
578 * ChildWindowFromPointEx (USER32.@)
580 HWND WINAPI ChildWindowFromPointEx( HWND hwndParent, POINT pt,
581 UINT uFlags)
583 /* pt is in the client coordinates */
585 WND* wnd = WIN_FindWndPtr(hwndParent);
586 RECT rect;
587 HWND retvalue;
589 if( !wnd ) return 0;
591 /* get client rect fast */
592 rect.top = rect.left = 0;
593 rect.right = wnd->rectClient.right - wnd->rectClient.left;
594 rect.bottom = wnd->rectClient.bottom - wnd->rectClient.top;
596 if (!PtInRect( &rect, pt ))
598 retvalue = 0;
599 goto end;
601 WIN_UpdateWndPtr(&wnd,wnd->child);
603 while ( wnd )
605 if (PtInRect( &wnd->rectWindow, pt )) {
606 if ( (uFlags & CWP_SKIPINVISIBLE) &&
607 !(wnd->dwStyle & WS_VISIBLE) );
608 else if ( (uFlags & CWP_SKIPDISABLED) &&
609 (wnd->dwStyle & WS_DISABLED) );
610 else if ( (uFlags & CWP_SKIPTRANSPARENT) &&
611 (wnd->dwExStyle & WS_EX_TRANSPARENT) );
612 else
614 retvalue = wnd->hwndSelf;
615 goto end;
619 WIN_UpdateWndPtr(&wnd,wnd->next);
621 retvalue = hwndParent;
622 end:
623 WIN_ReleaseWndPtr(wnd);
624 return retvalue;
628 /*******************************************************************
629 * WINPOS_GetWinOffset
631 * Calculate the offset between the origin of the two windows. Used
632 * to implement MapWindowPoints.
634 static void WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo,
635 POINT *offset )
637 WND * wndPtr = 0;
639 offset->x = offset->y = 0;
640 if (hwndFrom == hwndTo ) return;
642 /* Translate source window origin to screen coords */
643 if (hwndFrom)
645 if (!(wndPtr = WIN_FindWndPtr( hwndFrom )))
647 ERR("bad hwndFrom = %04x\n",hwndFrom);
648 return;
650 while (wndPtr->parent)
652 offset->x += wndPtr->rectClient.left;
653 offset->y += wndPtr->rectClient.top;
654 WIN_UpdateWndPtr(&wndPtr,wndPtr->parent);
656 WIN_ReleaseWndPtr(wndPtr);
659 /* Translate origin to destination window coords */
660 if (hwndTo)
662 if (!(wndPtr = WIN_FindWndPtr( hwndTo )))
664 ERR("bad hwndTo = %04x\n", hwndTo );
665 return;
667 while (wndPtr->parent)
669 offset->x -= wndPtr->rectClient.left;
670 offset->y -= wndPtr->rectClient.top;
671 WIN_UpdateWndPtr(&wndPtr,wndPtr->parent);
673 WIN_ReleaseWndPtr(wndPtr);
678 /*******************************************************************
679 * MapWindowPoints (USER.258)
681 void WINAPI MapWindowPoints16( HWND16 hwndFrom, HWND16 hwndTo,
682 LPPOINT16 lppt, UINT16 count )
684 POINT offset;
686 WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset );
687 while (count--)
689 lppt->x += offset.x;
690 lppt->y += offset.y;
691 lppt++;
696 /*******************************************************************
697 * MapWindowPoints (USER32.@)
699 INT WINAPI MapWindowPoints( HWND hwndFrom, HWND hwndTo,
700 LPPOINT lppt, UINT count )
702 POINT offset;
704 WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset );
705 while (count--)
707 lppt->x += offset.x;
708 lppt->y += offset.y;
709 lppt++;
711 return MAKELONG( LOWORD(offset.x), LOWORD(offset.y) );
715 /***********************************************************************
716 * IsIconic (USER.31)
718 BOOL16 WINAPI IsIconic16(HWND16 hWnd)
720 return IsIconic(hWnd);
724 /***********************************************************************
725 * IsIconic (USER32.@)
727 BOOL WINAPI IsIconic(HWND hWnd)
729 BOOL retvalue;
730 WND * wndPtr = WIN_FindWndPtr(hWnd);
731 if (wndPtr == NULL) return FALSE;
732 retvalue = (wndPtr->dwStyle & WS_MINIMIZE) != 0;
733 WIN_ReleaseWndPtr(wndPtr);
734 return retvalue;
738 /***********************************************************************
739 * IsZoomed (USER.272)
741 BOOL16 WINAPI IsZoomed16(HWND16 hWnd)
743 return IsZoomed(hWnd);
747 /***********************************************************************
748 * IsZoomed (USER32.@)
750 BOOL WINAPI IsZoomed(HWND hWnd)
752 BOOL retvalue;
753 WND * wndPtr = WIN_FindWndPtr(hWnd);
754 if (wndPtr == NULL) return FALSE;
755 retvalue = (wndPtr->dwStyle & WS_MAXIMIZE) != 0;
756 WIN_ReleaseWndPtr(wndPtr);
757 return retvalue;
761 /*******************************************************************
762 * GetActiveWindow (USER.60)
764 HWND16 WINAPI GetActiveWindow16(void)
766 return (HWND16)GetActiveWindow();
769 /*******************************************************************
770 * GetActiveWindow (USER32.@)
772 HWND WINAPI GetActiveWindow(void)
774 MESSAGEQUEUE *pCurMsgQ = 0;
776 /* Get the messageQ for the current thread */
777 if (!(pCurMsgQ = QUEUE_Current()))
779 WARN("\tCurrent message queue not found. Exiting!\n" );
780 return 0;
783 /* Return the current active window from the perQ data of the current message Q */
784 return PERQDATA_GetActiveWnd( pCurMsgQ->pQData );
788 /*******************************************************************
789 * WINPOS_CanActivate
791 static BOOL WINPOS_CanActivate(WND* pWnd)
793 if( pWnd && ( (pWnd->dwStyle & (WS_DISABLED | WS_VISIBLE | WS_CHILD))
794 == WS_VISIBLE ) ) return TRUE;
795 return FALSE;
799 /*******************************************************************
800 * SetActiveWindow (USER.59)
802 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
804 return SetActiveWindow(hwnd);
808 /*******************************************************************
809 * SetActiveWindow (USER32.@)
811 HWND WINAPI SetActiveWindow( HWND hwnd )
813 HWND prev = 0;
814 WND *wndPtr = WIN_FindWndPtr( hwnd );
815 MESSAGEQUEUE *pMsgQ = 0, *pCurMsgQ = 0;
817 if (!wndPtr || (wndPtr->dwStyle & (WS_DISABLED | WS_CHILD)))
819 prev = 0;
820 goto end;
823 /* Get the messageQ for the current thread */
824 if (!(pCurMsgQ = QUEUE_Current()))
826 WARN("\tCurrent message queue not found. Exiting!\n" );
827 goto CLEANUP;
830 /* Retrieve the message queue associated with this window */
831 pMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( wndPtr->hmemTaskQ );
832 if ( !pMsgQ )
834 WARN("\tWindow message queue not found. Exiting!\n" );
835 goto CLEANUP;
838 /* Make sure that the window is associated with the calling threads
839 * message queue. It must share the same perQ data.
842 if ( pCurMsgQ->pQData != pMsgQ->pQData )
843 goto CLEANUP;
845 /* Save current active window */
846 prev = PERQDATA_GetActiveWnd( pMsgQ->pQData );
848 WINPOS_SetActiveWindow( hwnd, 0, 0 );
850 CLEANUP:
851 /* Unlock the queues before returning */
852 if ( pMsgQ )
853 QUEUE_Unlock( pMsgQ );
855 end:
856 WIN_ReleaseWndPtr(wndPtr);
857 return prev;
861 /*******************************************************************
862 * GetForegroundWindow (USER.608)
864 HWND16 WINAPI GetForegroundWindow16(void)
866 return (HWND16)GetForegroundWindow();
870 /*******************************************************************
871 * SetForegroundWindow (USER.609)
873 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
875 return SetForegroundWindow( hwnd );
879 /*******************************************************************
880 * GetForegroundWindow (USER32.@)
882 HWND WINAPI GetForegroundWindow(void)
884 HWND hwndActive = 0;
886 /* Get the foreground window (active window of hActiveQueue) */
887 if ( hActiveQueue )
889 MESSAGEQUEUE *pActiveQueue = QUEUE_Lock( hActiveQueue );
890 if ( pActiveQueue )
891 hwndActive = PERQDATA_GetActiveWnd( pActiveQueue->pQData );
893 QUEUE_Unlock( pActiveQueue );
896 return hwndActive;
899 /*******************************************************************
900 * SetForegroundWindow (USER32.@)
902 BOOL WINAPI SetForegroundWindow( HWND hwnd )
904 return WINPOS_ChangeActiveWindow( hwnd, FALSE );
908 /*******************************************************************
909 * AllowSetForegroundWindow (USER32.@)
911 BOOL WINAPI AllowSetForegroundWindow( DWORD procid )
913 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
914 * implemented, then fix this function. */
915 return TRUE;
919 /*******************************************************************
920 * LockSetForegroundWindow (USER32.@)
922 BOOL WINAPI LockSetForegroundWindow( UINT lockcode )
924 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
925 * implemented, then fix this function. */
926 return TRUE;
930 /*******************************************************************
931 * GetShellWindow (USER.600)
933 HWND16 WINAPI GetShellWindow16(void)
935 return GetShellWindow();
938 /*******************************************************************
939 * SetShellWindow (USER32.@)
941 HWND WINAPI SetShellWindow(HWND hwndshell)
942 { WARN("(hWnd=%08x) semi stub\n",hwndshell );
944 hGlobalShellWindow = hwndshell;
945 return hGlobalShellWindow;
949 /*******************************************************************
950 * GetShellWindow (USER32.@)
952 HWND WINAPI GetShellWindow(void)
953 { WARN("(hWnd=%x) semi stub\n",hGlobalShellWindow );
955 return hGlobalShellWindow;
959 /***********************************************************************
960 * BringWindowToTop (USER.45)
962 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
964 return BringWindowToTop(hwnd);
968 /***********************************************************************
969 * BringWindowToTop (USER32.@)
971 BOOL WINAPI BringWindowToTop( HWND hwnd )
973 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
977 /***********************************************************************
978 * MoveWindow (USER.56)
980 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy,
981 BOOL16 repaint )
983 return MoveWindow(hwnd,x,y,cx,cy,repaint);
987 /***********************************************************************
988 * MoveWindow (USER32.@)
990 BOOL WINAPI MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
991 BOOL repaint )
993 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
994 if (!repaint) flags |= SWP_NOREDRAW;
995 TRACE("%04x %d,%d %dx%d %d\n",
996 hwnd, x, y, cx, cy, repaint );
997 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
1000 /***********************************************************************
1001 * WINPOS_InitInternalPos
1003 static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT pt,
1004 LPRECT restoreRect )
1006 LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( wnd->hwndSelf,
1007 atomInternalPos );
1008 if( !lpPos )
1010 /* this happens when the window is minimized/maximized
1011 * for the first time (rectWindow is not adjusted yet) */
1013 lpPos = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNALPOS) );
1014 if( !lpPos ) return NULL;
1016 SetPropA( wnd->hwndSelf, atomInternalPos, (HANDLE)lpPos );
1017 lpPos->hwndIconTitle = 0; /* defer until needs to be shown */
1018 CONV_RECT32TO16( &wnd->rectWindow, &lpPos->rectNormal );
1019 *(UINT*)&lpPos->ptIconPos = *(UINT*)&lpPos->ptMaxPos = 0xFFFFFFFF;
1022 if( wnd->dwStyle & WS_MINIMIZE )
1023 CONV_POINT32TO16( &pt, &lpPos->ptIconPos );
1024 else if( wnd->dwStyle & WS_MAXIMIZE )
1025 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
1026 else if( restoreRect )
1027 CONV_RECT32TO16( restoreRect, &lpPos->rectNormal );
1029 return lpPos;
1032 /***********************************************************************
1033 * WINPOS_RedrawIconTitle
1035 BOOL WINPOS_RedrawIconTitle( HWND hWnd )
1037 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hWnd, atomInternalPos );
1038 if( lpPos )
1040 if( lpPos->hwndIconTitle )
1042 SendMessageA( lpPos->hwndIconTitle, WM_SHOWWINDOW, TRUE, 0);
1043 InvalidateRect( lpPos->hwndIconTitle, NULL, TRUE );
1044 return TRUE;
1047 return FALSE;
1050 /***********************************************************************
1051 * WINPOS_ShowIconTitle
1053 BOOL WINPOS_ShowIconTitle( WND* pWnd, BOOL bShow )
1055 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( pWnd->hwndSelf, atomInternalPos );
1057 if( lpPos && !(pWnd->dwExStyle & WS_EX_MANAGED))
1059 HWND16 hWnd = lpPos->hwndIconTitle;
1061 TRACE("0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
1063 if( !hWnd )
1064 lpPos->hwndIconTitle = hWnd = ICONTITLE_Create( pWnd );
1065 if( bShow )
1067 if( ( pWnd = WIN_FindWndPtr(hWnd) ) != NULL)
1069 if( !(pWnd->dwStyle & WS_VISIBLE) )
1071 SendMessageA( hWnd, WM_SHOWWINDOW, TRUE, 0 );
1072 SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
1073 SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
1075 WIN_ReleaseWndPtr(pWnd);
1078 else ShowWindow( hWnd, SW_HIDE );
1080 return FALSE;
1083 /*******************************************************************
1084 * WINPOS_GetMinMaxInfo
1086 * Get the minimized and maximized information for a window.
1088 void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
1089 POINT *minTrack, POINT *maxTrack )
1091 LPINTERNALPOS lpPos;
1092 MINMAXINFO MinMax;
1093 INT xinc, yinc;
1095 /* Compute default values */
1097 MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);
1098 MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);
1099 MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
1100 MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
1101 MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
1102 MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
1104 if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
1106 xinc = GetSystemMetrics(SM_CXDLGFRAME);
1107 yinc = GetSystemMetrics(SM_CYDLGFRAME);
1109 else
1111 xinc = yinc = 0;
1112 if (HAS_THICKFRAME(wndPtr->dwStyle))
1114 xinc += GetSystemMetrics(SM_CXFRAME);
1115 yinc += GetSystemMetrics(SM_CYFRAME);
1117 if (wndPtr->dwStyle & WS_BORDER)
1119 xinc += GetSystemMetrics(SM_CXBORDER);
1120 yinc += GetSystemMetrics(SM_CYBORDER);
1123 MinMax.ptMaxSize.x += 2 * xinc;
1124 MinMax.ptMaxSize.y += 2 * yinc;
1126 lpPos = (LPINTERNALPOS)GetPropA( wndPtr->hwndSelf, atomInternalPos );
1127 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
1128 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
1129 else
1131 MinMax.ptMaxPosition.x = -xinc;
1132 MinMax.ptMaxPosition.y = -yinc;
1135 SendMessageA( wndPtr->hwndSelf, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
1137 /* Some sanity checks */
1139 TRACE("%ld %ld / %ld %ld / %ld %ld / %ld %ld\n",
1140 MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,
1141 MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
1142 MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
1143 MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y);
1144 MinMax.ptMaxTrackSize.x = max( MinMax.ptMaxTrackSize.x,
1145 MinMax.ptMinTrackSize.x );
1146 MinMax.ptMaxTrackSize.y = max( MinMax.ptMaxTrackSize.y,
1147 MinMax.ptMinTrackSize.y );
1149 if (maxSize) *maxSize = MinMax.ptMaxSize;
1150 if (maxPos) *maxPos = MinMax.ptMaxPosition;
1151 if (minTrack) *minTrack = MinMax.ptMinTrackSize;
1152 if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize;
1155 /***********************************************************************
1156 * ShowWindowAsync (USER32.@)
1158 * doesn't wait; returns immediately.
1159 * used by threads to toggle windows in other (possibly hanging) threads
1161 BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd )
1163 /* FIXME: does ShowWindow() return immediately ? */
1164 return ShowWindow(hwnd, cmd);
1168 /***********************************************************************
1169 * ShowWindow (USER.42)
1171 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
1173 return ShowWindow(hwnd,cmd);
1177 /***********************************************************************
1178 * ShowWindow (USER32.@)
1180 BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
1182 return USER_Driver.pShowWindow( hwnd, cmd );
1186 /***********************************************************************
1187 * GetInternalWindowPos (USER.460)
1189 UINT16 WINAPI GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd,
1190 LPPOINT16 ptIcon )
1192 WINDOWPLACEMENT16 wndpl;
1193 if (GetWindowPlacement16( hwnd, &wndpl ))
1195 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1196 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1197 return wndpl.showCmd;
1199 return 0;
1203 /***********************************************************************
1204 * GetInternalWindowPos (USER32.@)
1206 UINT WINAPI GetInternalWindowPos( HWND hwnd, LPRECT rectWnd,
1207 LPPOINT ptIcon )
1209 WINDOWPLACEMENT wndpl;
1210 if (GetWindowPlacement( hwnd, &wndpl ))
1212 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1213 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1214 return wndpl.showCmd;
1216 return 0;
1219 /***********************************************************************
1220 * GetWindowPlacement (USER.370)
1222 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wndpl )
1224 WND *pWnd = WIN_FindWndPtr( hwnd );
1225 LPINTERNALPOS lpPos;
1227 if(!pWnd ) return FALSE;
1229 lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
1230 *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
1231 wndpl->length = sizeof(*wndpl);
1232 if( pWnd->dwStyle & WS_MINIMIZE )
1233 wndpl->showCmd = SW_SHOWMINIMIZED;
1234 else
1235 wndpl->showCmd = ( pWnd->dwStyle & WS_MAXIMIZE )
1236 ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
1237 if( pWnd->flags & WIN_RESTORE_MAX )
1238 wndpl->flags = WPF_RESTORETOMAXIMIZED;
1239 else
1240 wndpl->flags = 0;
1241 wndpl->ptMinPosition = lpPos->ptIconPos;
1242 wndpl->ptMaxPosition = lpPos->ptMaxPos;
1243 wndpl->rcNormalPosition = lpPos->rectNormal;
1245 WIN_ReleaseWndPtr(pWnd);
1246 return TRUE;
1250 /***********************************************************************
1251 * GetWindowPlacement (USER32.@)
1253 * Win95:
1254 * Fails if wndpl->length of Win95 (!) apps is invalid.
1256 BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *pwpl32 )
1258 if( pwpl32 )
1260 WINDOWPLACEMENT16 wpl;
1261 wpl.length = sizeof(wpl);
1262 if( GetWindowPlacement16( hwnd, &wpl ) )
1264 pwpl32->length = sizeof(*pwpl32);
1265 pwpl32->flags = wpl.flags;
1266 pwpl32->showCmd = wpl.showCmd;
1267 CONV_POINT16TO32( &wpl.ptMinPosition, &pwpl32->ptMinPosition );
1268 CONV_POINT16TO32( &wpl.ptMaxPosition, &pwpl32->ptMaxPosition );
1269 CONV_RECT16TO32( &wpl.rcNormalPosition, &pwpl32->rcNormalPosition );
1270 return TRUE;
1273 return FALSE;
1277 /***********************************************************************
1278 * WINPOS_SetPlacement
1280 static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT16 *wndpl,
1281 UINT flags )
1283 WND *pWnd = WIN_FindWndPtr( hwnd );
1284 if( pWnd )
1286 LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
1287 *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
1289 if( flags & PLACE_MIN ) lpPos->ptIconPos = wndpl->ptMinPosition;
1290 if( flags & PLACE_MAX ) lpPos->ptMaxPos = wndpl->ptMaxPosition;
1291 if( flags & PLACE_RECT) lpPos->rectNormal = wndpl->rcNormalPosition;
1293 if( pWnd->dwStyle & WS_MINIMIZE )
1295 WINPOS_ShowIconTitle( pWnd, FALSE );
1296 if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
1297 SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
1298 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
1300 else if( pWnd->dwStyle & WS_MAXIMIZE )
1302 if( !EMPTYPOINT(lpPos->ptMaxPos) )
1303 SetWindowPos( hwnd, 0, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
1304 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
1306 else if( flags & PLACE_RECT )
1307 SetWindowPos( hwnd, 0, lpPos->rectNormal.left, lpPos->rectNormal.top,
1308 lpPos->rectNormal.right - lpPos->rectNormal.left,
1309 lpPos->rectNormal.bottom - lpPos->rectNormal.top,
1310 SWP_NOZORDER | SWP_NOACTIVATE );
1312 ShowWindow( hwnd, wndpl->showCmd );
1313 if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
1315 if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd, TRUE );
1317 /* SDK: ...valid only the next time... */
1318 if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
1320 WIN_ReleaseWndPtr(pWnd);
1321 return TRUE;
1323 return FALSE;
1327 /***********************************************************************
1328 * SetWindowPlacement (USER.371)
1330 BOOL16 WINAPI SetWindowPlacement16(HWND16 hwnd, const WINDOWPLACEMENT16 *wndpl)
1332 return WINPOS_SetPlacement( hwnd, wndpl,
1333 PLACE_MIN | PLACE_MAX | PLACE_RECT );
1336 /***********************************************************************
1337 * SetWindowPlacement (USER32.@)
1339 * Win95:
1340 * Fails if wndpl->length of Win95 (!) apps is invalid.
1342 BOOL WINAPI SetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *pwpl32 )
1344 if( pwpl32 )
1346 WINDOWPLACEMENT16 wpl;
1348 wpl.length = sizeof(WINDOWPLACEMENT16);
1349 wpl.flags = pwpl32->flags;
1350 wpl.showCmd = pwpl32->showCmd;
1351 wpl.ptMinPosition.x = pwpl32->ptMinPosition.x;
1352 wpl.ptMinPosition.y = pwpl32->ptMinPosition.y;
1353 wpl.ptMaxPosition.x = pwpl32->ptMaxPosition.x;
1354 wpl.ptMaxPosition.y = pwpl32->ptMaxPosition.y;
1355 wpl.rcNormalPosition.left = pwpl32->rcNormalPosition.left;
1356 wpl.rcNormalPosition.top = pwpl32->rcNormalPosition.top;
1357 wpl.rcNormalPosition.right = pwpl32->rcNormalPosition.right;
1358 wpl.rcNormalPosition.bottom = pwpl32->rcNormalPosition.bottom;
1360 return WINPOS_SetPlacement( hwnd, &wpl, PLACE_MIN | PLACE_MAX | PLACE_RECT );
1362 return FALSE;
1366 /***********************************************************************
1367 * SetInternalWindowPos (USER.461)
1369 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd,
1370 LPRECT16 rect, LPPOINT16 pt )
1372 if( IsWindow16(hwnd) )
1374 WINDOWPLACEMENT16 wndpl;
1375 UINT flags;
1377 wndpl.length = sizeof(wndpl);
1378 wndpl.showCmd = showCmd;
1379 wndpl.flags = flags = 0;
1381 if( pt )
1383 flags |= PLACE_MIN;
1384 wndpl.flags |= WPF_SETMINPOSITION;
1385 wndpl.ptMinPosition = *pt;
1387 if( rect )
1389 flags |= PLACE_RECT;
1390 wndpl.rcNormalPosition = *rect;
1392 WINPOS_SetPlacement( hwnd, &wndpl, flags );
1396 /***********************************************************************
1397 * AnimateWindow (USER32.@)
1398 * Shows/Hides a window with an animation
1399 * NO ANIMATION YET
1401 BOOL WINAPI AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags)
1403 FIXME("partial stub\n");
1405 /* If trying to show/hide and it's already *
1406 * shown/hidden or invalid window, fail with *
1407 * invalid parameter */
1408 if(!IsWindow(hwnd) ||
1409 (IsWindowVisible(hwnd) && !(dwFlags & AW_HIDE)) ||
1410 (!IsWindowVisible(hwnd) && (dwFlags & AW_HIDE)))
1412 SetLastError(ERROR_INVALID_PARAMETER);
1413 return FALSE;
1416 ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
1418 return TRUE;
1421 /***********************************************************************
1422 * SetInternalWindowPos (USER32.@)
1424 void WINAPI SetInternalWindowPos( HWND hwnd, UINT showCmd,
1425 LPRECT rect, LPPOINT pt )
1427 if( IsWindow(hwnd) )
1429 WINDOWPLACEMENT16 wndpl;
1430 UINT flags;
1432 wndpl.length = sizeof(wndpl);
1433 wndpl.showCmd = showCmd;
1434 wndpl.flags = flags = 0;
1436 if( pt )
1438 flags |= PLACE_MIN;
1439 wndpl.flags |= WPF_SETMINPOSITION;
1440 CONV_POINT32TO16( pt, &wndpl.ptMinPosition );
1442 if( rect )
1444 flags |= PLACE_RECT;
1445 CONV_RECT32TO16( rect, &wndpl.rcNormalPosition );
1447 WINPOS_SetPlacement( hwnd, &wndpl, flags );
1451 /*******************************************************************
1452 * WINPOS_SetActiveWindow
1454 * SetActiveWindow() back-end. This is the only function that
1455 * can assign active status to a window. It must be called only
1456 * for the top level windows.
1458 BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
1460 WND* wndPtr=0, *wndTemp;
1461 HQUEUE16 hOldActiveQueue, hNewActiveQueue;
1462 MESSAGEQUEUE *pOldActiveQueue = 0, *pNewActiveQueue = 0;
1463 WORD wIconized = 0;
1464 HWND hwndActive = 0;
1465 BOOL bRet = 0;
1467 TRACE("(%04x, %d, %d)\n", hWnd, fMouse, fChangeFocus );
1469 /* Get current active window from the active queue */
1470 if ( hActiveQueue )
1472 pOldActiveQueue = QUEUE_Lock( hActiveQueue );
1473 if ( pOldActiveQueue )
1474 hwndActive = PERQDATA_GetActiveWnd( pOldActiveQueue->pQData );
1477 /* paranoid checks */
1478 if( hWnd == GetDesktopWindow() || (bRet = (hWnd == hwndActive)) )
1479 goto CLEANUP_END;
1481 /* if (wndPtr && (GetFastQueue16() != wndPtr->hmemTaskQ))
1482 * return 0;
1484 wndPtr = WIN_FindWndPtr(hWnd);
1485 hOldActiveQueue = hActiveQueue;
1487 if( (wndTemp = WIN_FindWndPtr(hwndActive)) )
1489 wIconized = HIWORD(wndTemp->dwStyle & WS_MINIMIZE);
1490 WIN_ReleaseWndPtr(wndTemp);
1492 else
1493 TRACE("no current active window.\n");
1495 /* call CBT hook chain */
1496 if (HOOK_IsHooked( WH_CBT ))
1498 CBTACTIVATESTRUCT cbt;
1499 cbt.fMouse = fMouse;
1500 cbt.hWndActive = hwndActive;
1501 if (HOOK_CallHooksA( WH_CBT, HCBT_ACTIVATE, hWnd, (LPARAM)&cbt )) goto CLEANUP_END;
1504 /* set prev active wnd to current active wnd and send notification */
1505 if ((hwndPrevActive = hwndActive) && IsWindow(hwndPrevActive))
1507 MESSAGEQUEUE *pTempActiveQueue = 0;
1509 if (!SendMessageA( hwndPrevActive, WM_NCACTIVATE, FALSE, 0 ))
1511 if (GetSysModalWindow16() != hWnd)
1512 goto CLEANUP_END;
1513 /* disregard refusal if hWnd is sysmodal */
1516 SendMessageA( hwndPrevActive, WM_ACTIVATE,
1517 MAKEWPARAM( WA_INACTIVE, wIconized ),
1518 (LPARAM)hWnd );
1520 /* check if something happened during message processing
1521 * (global active queue may have changed)
1523 pTempActiveQueue = QUEUE_Lock( hActiveQueue );
1524 if(!pTempActiveQueue)
1525 goto CLEANUP_END;
1527 hwndActive = PERQDATA_GetActiveWnd( pTempActiveQueue->pQData );
1528 QUEUE_Unlock( pTempActiveQueue );
1529 if( hwndPrevActive != hwndActive )
1530 goto CLEANUP_END;
1533 /* Set new active window in the message queue */
1534 hwndActive = hWnd;
1535 if ( wndPtr )
1537 pNewActiveQueue = QUEUE_Lock( wndPtr->hmemTaskQ );
1538 if ( pNewActiveQueue )
1539 PERQDATA_SetActiveWnd( pNewActiveQueue->pQData, hwndActive );
1541 else /* have to do this or MDI frame activation goes to hell */
1542 if( pOldActiveQueue )
1543 PERQDATA_SetActiveWnd( pOldActiveQueue->pQData, 0 );
1545 /* send palette messages */
1546 if (hWnd && SendMessage16( hWnd, WM_QUERYNEWPALETTE, 0, 0L))
1547 SendMessage16((HWND16)-1, WM_PALETTEISCHANGING, (WPARAM16)hWnd, 0L );
1549 /* if prev wnd is minimized redraw icon title */
1550 if( IsIconic( hwndPrevActive ) ) WINPOS_RedrawIconTitle(hwndPrevActive);
1552 /* managed windows will get ConfigureNotify event */
1553 if (wndPtr && !(wndPtr->dwStyle & WS_CHILD) && !(wndPtr->dwExStyle & WS_EX_MANAGED))
1555 /* check Z-order and bring hWnd to the top */
1556 for (wndTemp = WIN_LockWndPtr(WIN_GetDesktop()->child); wndTemp; WIN_UpdateWndPtr(&wndTemp,wndTemp->next))
1558 if (wndTemp->dwStyle & WS_VISIBLE) break;
1560 WIN_ReleaseDesktop();
1561 WIN_ReleaseWndPtr(wndTemp);
1563 if( wndTemp != wndPtr )
1564 SetWindowPos(hWnd, HWND_TOP, 0,0,0,0,
1565 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
1566 if (!IsWindow(hWnd))
1567 goto CLEANUP;
1570 /* Get a handle to the new active queue */
1571 hNewActiveQueue = wndPtr ? wndPtr->hmemTaskQ : 0;
1573 /* send WM_ACTIVATEAPP if necessary */
1574 if (hOldActiveQueue != hNewActiveQueue)
1576 WND **list, **ppWnd;
1577 WND *pDesktop = WIN_GetDesktop();
1579 if ((list = WIN_BuildWinArray( pDesktop, 0, NULL )))
1581 DWORD new_thread = GetWindowThreadProcessId( hwndActive, NULL );
1582 for (ppWnd = list; *ppWnd; ppWnd++)
1584 if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
1586 if ((*ppWnd)->hmemTaskQ == hOldActiveQueue)
1587 SendMessageW( (*ppWnd)->hwndSelf, WM_ACTIVATEAPP, 0, new_thread );
1589 WIN_ReleaseWinArray(list);
1592 hActiveQueue = hNewActiveQueue;
1594 if ((list = WIN_BuildWinArray(pDesktop, 0, NULL )))
1596 DWORD old_thread = GetWindowThreadProcessId( hwndPrevActive, NULL );
1597 for (ppWnd = list; *ppWnd; ppWnd++)
1599 if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
1601 if ((*ppWnd)->hmemTaskQ == hNewActiveQueue)
1602 SendMessageW( (*ppWnd)->hwndSelf, WM_ACTIVATEAPP, 1, old_thread );
1604 WIN_ReleaseWinArray(list);
1606 WIN_ReleaseDesktop();
1608 if (hWnd && !IsWindow(hWnd)) goto CLEANUP;
1611 if (hWnd)
1613 /* walk up to the first unowned window */
1614 wndTemp = WIN_LockWndPtr(wndPtr);
1615 while (wndTemp->owner)
1617 WIN_UpdateWndPtr(&wndTemp,wndTemp->owner);
1619 /* and set last active owned popup */
1620 wndTemp->hwndLastActive = hWnd;
1622 wIconized = HIWORD(wndTemp->dwStyle & WS_MINIMIZE);
1623 WIN_ReleaseWndPtr(wndTemp);
1624 SendMessageA( hWnd, WM_NCACTIVATE, TRUE, 0 );
1625 SendMessageA( hWnd, WM_ACTIVATE,
1626 MAKEWPARAM( (fMouse) ? WA_CLICKACTIVE : WA_ACTIVE, wIconized),
1627 (LPARAM)hwndPrevActive );
1628 if( !IsWindow(hWnd) ) goto CLEANUP;
1631 /* change focus if possible */
1632 if ( fChangeFocus )
1634 if ( pNewActiveQueue )
1636 HWND hOldFocus = PERQDATA_GetFocusWnd( pNewActiveQueue->pQData );
1638 if ( hOldFocus && WIN_GetTopParent( hOldFocus ) != hwndActive )
1639 FOCUS_SwitchFocus( pNewActiveQueue, hOldFocus,
1640 (wndPtr && (wndPtr->dwStyle & WS_MINIMIZE))?
1641 0 : hwndActive );
1644 if ( pOldActiveQueue &&
1645 ( !pNewActiveQueue ||
1646 pNewActiveQueue->pQData != pOldActiveQueue->pQData ) )
1648 HWND hOldFocus = PERQDATA_GetFocusWnd( pOldActiveQueue->pQData );
1649 if ( hOldFocus )
1650 FOCUS_SwitchFocus( pOldActiveQueue, hOldFocus, 0 );
1654 if( !hwndPrevActive && wndPtr )
1656 if (USER_Driver.pForceWindowRaise) USER_Driver.pForceWindowRaise( wndPtr->hwndSelf );
1659 /* if active wnd is minimized redraw icon title */
1660 if( IsIconic(hwndActive) ) WINPOS_RedrawIconTitle(hwndActive);
1662 bRet = (hWnd == hwndActive); /* Success? */
1664 CLEANUP: /* Unlock the message queues before returning */
1666 if ( pNewActiveQueue )
1667 QUEUE_Unlock( pNewActiveQueue );
1669 CLEANUP_END:
1671 if ( pOldActiveQueue )
1672 QUEUE_Unlock( pOldActiveQueue );
1674 WIN_ReleaseWndPtr(wndPtr);
1675 return bRet;
1678 /*******************************************************************
1679 * WINPOS_ActivateOtherWindow
1681 * Activates window other than pWnd.
1683 BOOL WINPOS_ActivateOtherWindow(WND* pWnd)
1685 BOOL bRet = 0;
1686 WND* pWndTo = NULL;
1687 HWND hwndActive = 0;
1689 /* Get current active window from the active queue */
1690 if ( hActiveQueue )
1692 MESSAGEQUEUE *pActiveQueue = QUEUE_Lock( hActiveQueue );
1693 if ( pActiveQueue )
1695 hwndActive = PERQDATA_GetActiveWnd( pActiveQueue->pQData );
1696 QUEUE_Unlock( pActiveQueue );
1700 if( pWnd->hwndSelf == hwndPrevActive )
1701 hwndPrevActive = 0;
1703 if( hwndActive != pWnd->hwndSelf &&
1704 ( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
1705 return 0;
1707 if( !(pWnd->dwStyle & WS_POPUP) || !(pWnd->owner) ||
1708 !WINPOS_CanActivate((pWndTo = WIN_GetTopParentPtr(pWnd->owner))) )
1710 WND* pWndPtr = WIN_GetTopParentPtr(pWnd);
1712 WIN_ReleaseWndPtr(pWndTo);
1713 pWndTo = WIN_FindWndPtr(hwndPrevActive);
1715 while( !WINPOS_CanActivate(pWndTo) )
1717 /* by now owned windows should've been taken care of */
1718 WIN_UpdateWndPtr(&pWndTo,pWndPtr->next);
1719 WIN_UpdateWndPtr(&pWndPtr,pWndTo);
1720 if( !pWndTo ) break;
1722 WIN_ReleaseWndPtr(pWndPtr);
1725 bRet = WINPOS_SetActiveWindow( pWndTo ? pWndTo->hwndSelf : 0, FALSE, TRUE );
1727 if( pWndTo ) WIN_ReleaseWndPtr(pWndTo);
1729 hwndPrevActive = 0;
1730 return bRet;
1733 /*******************************************************************
1734 * WINPOS_ChangeActiveWindow
1737 BOOL WINPOS_ChangeActiveWindow( HWND hWnd, BOOL mouseMsg )
1739 WND *wndPtr;
1740 BOOL retvalue;
1741 HWND hwndActive = 0;
1743 /* Get current active window from the active queue */
1744 if ( hActiveQueue )
1746 MESSAGEQUEUE *pActiveQueue = QUEUE_Lock( hActiveQueue );
1747 if ( pActiveQueue )
1749 hwndActive = PERQDATA_GetActiveWnd( pActiveQueue->pQData );
1750 QUEUE_Unlock( pActiveQueue );
1754 if (!hWnd)
1755 return WINPOS_SetActiveWindow( 0, mouseMsg, TRUE );
1757 wndPtr = WIN_FindWndPtr(hWnd);
1758 if( !wndPtr ) return FALSE;
1760 /* child windows get WM_CHILDACTIVATE message */
1761 if( (wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD )
1763 retvalue = SendMessageA(hWnd, WM_CHILDACTIVATE, 0, 0L);
1764 goto end;
1767 if( hWnd == hwndActive )
1769 retvalue = FALSE;
1770 goto end;
1773 if( !WINPOS_SetActiveWindow(hWnd ,mouseMsg ,TRUE) )
1775 retvalue = FALSE;
1776 goto end;
1779 retvalue = TRUE;
1780 end:
1781 WIN_ReleaseWndPtr(wndPtr);
1782 return retvalue;
1786 /***********************************************************************
1787 * WINPOS_SendNCCalcSize
1789 * Send a WM_NCCALCSIZE message to a window.
1790 * All parameters are read-only except newClientRect.
1791 * oldWindowRect, oldClientRect and winpos must be non-NULL only
1792 * when calcValidRect is TRUE.
1794 LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
1795 RECT *newWindowRect, RECT *oldWindowRect,
1796 RECT *oldClientRect, WINDOWPOS *winpos,
1797 RECT *newClientRect )
1799 NCCALCSIZE_PARAMS params;
1800 WINDOWPOS winposCopy;
1801 LONG result;
1803 params.rgrc[0] = *newWindowRect;
1804 if (calcValidRect)
1806 winposCopy = *winpos;
1807 params.rgrc[1] = *oldWindowRect;
1808 params.rgrc[2] = *oldClientRect;
1809 params.lppos = &winposCopy;
1811 result = SendMessageA( hwnd, WM_NCCALCSIZE, calcValidRect,
1812 (LPARAM)&params );
1813 TRACE("%d,%d-%d,%d\n",
1814 params.rgrc[0].left, params.rgrc[0].top,
1815 params.rgrc[0].right, params.rgrc[0].bottom );
1817 /* If the application send back garbage, ignore it */
1818 if (params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom)
1819 *newClientRect = params.rgrc[0];
1821 return result;
1825 /***********************************************************************
1826 * WINPOS_HandleWindowPosChanging16
1828 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1830 LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos )
1832 POINT maxSize, minTrack;
1833 if (winpos->flags & SWP_NOSIZE) return 0;
1834 if ((wndPtr->dwStyle & WS_THICKFRAME) ||
1835 ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
1837 WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL );
1838 if (maxSize.x < winpos->cx) winpos->cx = maxSize.x;
1839 if (maxSize.y < winpos->cy) winpos->cy = maxSize.y;
1840 if (!(wndPtr->dwStyle & WS_MINIMIZE))
1842 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1843 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1846 return 0;
1850 /***********************************************************************
1851 * WINPOS_HandleWindowPosChanging
1853 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1855 LONG WINPOS_HandleWindowPosChanging( WND *wndPtr, WINDOWPOS *winpos )
1857 POINT maxSize, minTrack;
1858 if (winpos->flags & SWP_NOSIZE) return 0;
1859 if ((wndPtr->dwStyle & WS_THICKFRAME) ||
1860 ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
1862 WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL );
1863 winpos->cx = min( winpos->cx, maxSize.x );
1864 winpos->cy = min( winpos->cy, maxSize.y );
1865 if (!(wndPtr->dwStyle & WS_MINIMIZE))
1867 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1868 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1871 return 0;
1874 /***********************************************************************
1875 * SetWindowPos (USER.232)
1877 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
1878 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
1880 return SetWindowPos(hwnd,(INT)(INT16)hwndInsertAfter,x,y,cx,cy,flags);
1883 /***********************************************************************
1884 * SetWindowPos (USER32.@)
1886 BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
1887 INT x, INT y, INT cx, INT cy, UINT flags )
1889 WINDOWPOS winpos;
1891 winpos.hwnd = hwnd;
1892 winpos.hwndInsertAfter = hwndInsertAfter;
1893 winpos.x = x;
1894 winpos.y = y;
1895 winpos.cx = cx;
1896 winpos.cy = cy;
1897 winpos.flags = flags;
1898 return USER_Driver.pSetWindowPos( &winpos );
1902 /***********************************************************************
1903 * BeginDeferWindowPos (USER.259)
1905 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1907 return BeginDeferWindowPos( count );
1911 /***********************************************************************
1912 * BeginDeferWindowPos (USER32.@)
1914 HDWP WINAPI BeginDeferWindowPos( INT count )
1916 HDWP handle;
1917 DWP *pDWP;
1919 if (count < 0)
1921 SetLastError(ERROR_INVALID_PARAMETER);
1922 return 0;
1924 /* Windows allows zero count, in which case it allocates context for 8 moves */
1925 if (count == 0) count = 8;
1927 handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
1928 if (!handle) return 0;
1929 pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle );
1930 pDWP->actualCount = 0;
1931 pDWP->suggestedCount = count;
1932 pDWP->valid = TRUE;
1933 pDWP->wMagic = DWP_MAGIC;
1934 pDWP->hwndParent = 0;
1935 return handle;
1939 /***********************************************************************
1940 * DeferWindowPos (USER.260)
1942 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1943 INT16 x, INT16 y, INT16 cx, INT16 cy,
1944 UINT16 flags )
1946 return DeferWindowPos( hdwp, hwnd, (INT)(INT16)hwndAfter,
1947 x, y, cx, cy, flags );
1951 /***********************************************************************
1952 * DeferWindowPos (USER32.@)
1954 HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
1955 INT x, INT y, INT cx, INT cy,
1956 UINT flags )
1958 DWP *pDWP;
1959 int i;
1960 HDWP newhdwp = hdwp,retvalue;
1961 /* HWND parent; */
1962 WND *pWnd;
1964 pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
1965 if (!pDWP) return 0;
1966 if (hwnd == GetDesktopWindow()) return 0;
1968 if (!(pWnd=WIN_FindWndPtr( hwnd ))) {
1969 USER_HEAP_FREE( hdwp );
1970 return 0;
1973 /* Numega Bounds Checker Demo dislikes the following code.
1974 In fact, I've not been able to find any "same parent" requirement in any docu
1975 [AM 980509]
1977 #if 0
1978 /* All the windows of a DeferWindowPos() must have the same parent */
1979 parent = pWnd->parent->hwndSelf;
1980 if (pDWP->actualCount == 0) pDWP->hwndParent = parent;
1981 else if (parent != pDWP->hwndParent)
1983 USER_HEAP_FREE( hdwp );
1984 retvalue = 0;
1985 goto END;
1987 #endif
1989 for (i = 0; i < pDWP->actualCount; i++)
1991 if (pDWP->winPos[i].hwnd == hwnd)
1993 /* Merge with the other changes */
1994 if (!(flags & SWP_NOZORDER))
1996 pDWP->winPos[i].hwndInsertAfter = hwndAfter;
1998 if (!(flags & SWP_NOMOVE))
2000 pDWP->winPos[i].x = x;
2001 pDWP->winPos[i].y = y;
2003 if (!(flags & SWP_NOSIZE))
2005 pDWP->winPos[i].cx = cx;
2006 pDWP->winPos[i].cy = cy;
2008 pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
2009 SWP_NOZORDER | SWP_NOREDRAW |
2010 SWP_NOACTIVATE | SWP_NOCOPYBITS|
2011 SWP_NOOWNERZORDER);
2012 pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
2013 SWP_FRAMECHANGED);
2014 retvalue = hdwp;
2015 goto END;
2018 if (pDWP->actualCount >= pDWP->suggestedCount)
2020 newhdwp = USER_HEAP_REALLOC( hdwp,
2021 sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS) );
2022 if (!newhdwp)
2024 retvalue = 0;
2025 goto END;
2027 pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp );
2028 pDWP->suggestedCount++;
2030 pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
2031 pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
2032 pDWP->winPos[pDWP->actualCount].x = x;
2033 pDWP->winPos[pDWP->actualCount].y = y;
2034 pDWP->winPos[pDWP->actualCount].cx = cx;
2035 pDWP->winPos[pDWP->actualCount].cy = cy;
2036 pDWP->winPos[pDWP->actualCount].flags = flags;
2037 pDWP->actualCount++;
2038 retvalue = newhdwp;
2039 END:
2040 WIN_ReleaseWndPtr(pWnd);
2041 return retvalue;
2045 /***********************************************************************
2046 * EndDeferWindowPos (USER.261)
2048 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
2050 return EndDeferWindowPos( hdwp );
2054 /***********************************************************************
2055 * EndDeferWindowPos (USER32.@)
2057 BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
2059 DWP *pDWP;
2060 WINDOWPOS *winpos;
2061 BOOL res = TRUE;
2062 int i;
2064 pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
2065 if (!pDWP) return FALSE;
2066 for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
2068 if (!(res = USER_Driver.pSetWindowPos( winpos ))) break;
2070 USER_HEAP_FREE( hdwp );
2071 return res;
2075 /***********************************************************************
2076 * TileChildWindows (USER.199)
2078 void WINAPI TileChildWindows16( HWND16 parent, WORD action )
2080 FIXME("(%04x, %d): stub\n", parent, action);
2083 /***********************************************************************
2084 * CascadeChildWindows (USER.198)
2086 void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
2088 FIXME("(%04x, %d): stub\n", parent, action);
2091 /***********************************************************************
2092 * SetProgmanWindow (USER32.@)
2094 HRESULT WINAPI SetProgmanWindow ( HWND hwnd )
2096 hGlobalProgmanWindow = hwnd;
2097 return hGlobalProgmanWindow;
2100 /***********************************************************************
2101 * GetProgmanWindow (USER32.@)
2103 HRESULT WINAPI GetProgmanWindow ( )
2105 return hGlobalProgmanWindow;
2108 /***********************************************************************
2109 * SetShellWindowEx (USER32.@)
2110 * hwndProgman = Progman[Program Manager]
2111 * |-> SHELLDLL_DefView
2112 * hwndListView = | |-> SysListView32
2113 * | | |-> tooltips_class32
2114 * | |
2115 * | |-> SysHeader32
2116 * |
2117 * |-> ProxyTarget
2119 HRESULT WINAPI SetShellWindowEx ( HWND hwndProgman, HWND hwndListView )
2121 FIXME("0x%08x 0x%08x stub\n",hwndProgman ,hwndListView );
2122 hGlobalShellWindow = hwndProgman;
2123 return hGlobalShellWindow;
2127 /***********************************************************************
2128 * SetTaskmanWindow (USER32.@)
2129 * NOTES
2130 * hwnd = MSTaskSwWClass
2131 * |-> SysTabControl32
2133 HRESULT WINAPI SetTaskmanWindow ( HWND hwnd )
2135 hGlobalTaskmanWindow = hwnd;
2136 return hGlobalTaskmanWindow;
2139 /***********************************************************************
2140 * GetTaskmanWindow (USER32.@)
2142 HRESULT WINAPI GetTaskmanWindow ( )
2144 return hGlobalTaskmanWindow;