Fix spec for InitiateSystemShutdownExA, as pointed out by Stefan
[wine/multimedia.git] / windows / winpos.c
blob666055227f5942f3cbeabfbc83f259cb6edc762d
1 /*
2 * Window position related functions.
4 * Copyright 1993, 1994, 1995 Alexandre Julliard
5 * 1995, 1996, 1999 Alex Korobka
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <string.h>
23 #include "winerror.h"
24 #include "windef.h"
25 #include "wingdi.h"
26 #include "winerror.h"
27 #include "wine/winuser16.h"
28 #include "wine/server.h"
29 #include "controls.h"
30 #include "user.h"
31 #include "win.h"
32 #include "message.h"
33 #include "winpos.h"
34 #include "nonclient.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(win);
39 #define HAS_DLGFRAME(style,exStyle) \
40 (((exStyle) & WS_EX_DLGMODALFRAME) || \
41 (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
43 #define HAS_THICKFRAME(style) \
44 (((style) & WS_THICKFRAME) && \
45 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
47 #define EMPTYPOINT(pt) ((*(LONG*)&(pt)) == -1)
49 #define PLACE_MIN 0x0001
50 #define PLACE_MAX 0x0002
51 #define PLACE_RECT 0x0004
54 #define DWP_MAGIC ((INT)('W' | ('P' << 8) | ('O' << 16) | ('S' << 24)))
56 typedef struct
58 INT actualCount;
59 INT suggestedCount;
60 BOOL valid;
61 INT wMagic;
62 HWND hwndParent;
63 WINDOWPOS winPos[1];
64 } DWP;
66 /* ----- internal variables ----- */
68 static HWND hGlobalShellWindow=0; /*the shell*/
69 static HWND hGlobalTaskmanWindow=0;
70 static HWND hGlobalProgmanWindow=0;
72 static LPCSTR atomInternalPos;
75 /***********************************************************************
76 * WINPOS_CreateInternalPosAtom
78 BOOL WINPOS_CreateInternalPosAtom()
80 LPSTR str = "SysIP";
81 atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str);
82 return (atomInternalPos) ? TRUE : FALSE;
85 /***********************************************************************
86 * WINPOS_CheckInternalPos
88 * Called when a window is destroyed.
90 void WINPOS_CheckInternalPos( HWND hwnd )
92 LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
94 if( lpPos )
96 if( IsWindow(lpPos->hwndIconTitle) )
97 DestroyWindow( lpPos->hwndIconTitle );
98 HeapFree( GetProcessHeap(), 0, lpPos );
102 /***********************************************************************
103 * ArrangeIconicWindows (USER32.@)
105 UINT WINAPI ArrangeIconicWindows( HWND parent )
107 RECT rectParent;
108 HWND hwndChild;
109 INT x, y, xspacing, yspacing;
111 GetClientRect( parent, &rectParent );
112 x = rectParent.left;
113 y = rectParent.bottom;
114 xspacing = GetSystemMetrics(SM_CXICONSPACING);
115 yspacing = GetSystemMetrics(SM_CYICONSPACING);
117 hwndChild = GetWindow( parent, GW_CHILD );
118 while (hwndChild)
120 if( IsIconic( hwndChild ) )
122 WINPOS_ShowIconTitle( hwndChild, FALSE );
124 SetWindowPos( hwndChild, 0, x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
125 y - yspacing - GetSystemMetrics(SM_CYICON)/2, 0, 0,
126 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
127 if( IsWindow(hwndChild) )
128 WINPOS_ShowIconTitle(hwndChild , TRUE );
130 if (x <= rectParent.right - xspacing) x += xspacing;
131 else
133 x = rectParent.left;
134 y -= yspacing;
137 hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
139 return yspacing;
143 /***********************************************************************
144 * SwitchToThisWindow (USER32.@)
146 void WINAPI SwitchToThisWindow( HWND hwnd, BOOL restore )
148 ShowWindow( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
152 /***********************************************************************
153 * GetWindowRect (USER32.@)
155 BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
157 BOOL ret = WIN_GetRectangles( hwnd, rect, NULL );
158 if (ret)
160 MapWindowPoints( GetAncestor( hwnd, GA_PARENT ), 0, (POINT *)rect, 2 );
161 TRACE( "hwnd %p (%ld,%ld)-(%ld,%ld)\n",
162 hwnd, rect->left, rect->top, rect->right, rect->bottom);
164 return ret;
168 /***********************************************************************
169 * GetWindowRgn (USER32.@)
171 int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
173 int nRet = ERROR;
174 WND *wndPtr = WIN_GetPtr( hwnd );
176 if (wndPtr == WND_OTHER_PROCESS)
178 if (IsWindow( hwnd ))
179 FIXME( "not supported on other process window %p\n", hwnd );
180 wndPtr = NULL;
182 if (!wndPtr)
184 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
185 return ERROR;
187 if (wndPtr->hrgnWnd) nRet = CombineRgn( hrgn, wndPtr->hrgnWnd, 0, RGN_COPY );
188 WIN_ReleasePtr( wndPtr );
189 return nRet;
193 /***********************************************************************
194 * SetWindowRgn (USER32.@)
196 int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
198 RECT rect;
199 WND *wndPtr;
201 if (hrgn) /* verify that region really exists */
203 if (GetRgnBox( hrgn, &rect ) == ERROR) return FALSE;
206 if (USER_Driver.pSetWindowRgn)
207 return USER_Driver.pSetWindowRgn( hwnd, hrgn, bRedraw );
209 if ((wndPtr = WIN_GetPtr( hwnd )) == WND_OTHER_PROCESS)
211 if (IsWindow( hwnd ))
212 FIXME( "not supported on other process window %p\n", hwnd );
213 wndPtr = NULL;
215 if (!wndPtr)
217 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
218 return FALSE;
221 if (wndPtr->hrgnWnd == hrgn)
223 WIN_ReleasePtr( wndPtr );
224 return TRUE;
227 if (wndPtr->hrgnWnd)
229 /* delete previous region */
230 DeleteObject(wndPtr->hrgnWnd);
231 wndPtr->hrgnWnd = 0;
233 wndPtr->hrgnWnd = hrgn;
234 WIN_ReleasePtr( wndPtr );
236 /* Size the window to the rectangle of the new region (if it isn't NULL) */
237 if (hrgn) SetWindowPos( hwnd, 0, rect.left, rect.top,
238 rect.right - rect.left, rect.bottom - rect.top,
239 SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOACTIVATE |
240 SWP_NOZORDER | (bRedraw ? 0 : SWP_NOREDRAW) );
241 return TRUE;
245 /***********************************************************************
246 * GetClientRect (USER32.@)
248 BOOL WINAPI GetClientRect( HWND hwnd, LPRECT rect )
250 BOOL ret;
252 rect->right = rect->bottom = 0;
253 if ((ret = WIN_GetRectangles( hwnd, NULL, rect )))
255 rect->right -= rect->left;
256 rect->bottom -= rect->top;
258 rect->left = rect->top = 0;
259 return ret;
263 /*******************************************************************
264 * ClientToScreen (USER32.@)
266 BOOL WINAPI ClientToScreen( HWND hwnd, LPPOINT lppnt )
268 MapWindowPoints( hwnd, 0, lppnt, 1 );
269 return TRUE;
273 /*******************************************************************
274 * ScreenToClient (USER32.@)
276 BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
278 MapWindowPoints( 0, hwnd, lppnt, 1 );
279 return TRUE;
283 /***********************************************************************
284 * find_child_from_point
286 * Find the child that contains pt. Helper for WindowFromPoint.
287 * pt is in parent client coordinates.
288 * lparam is the param to pass in the WM_NCHITTEST message.
290 static HWND find_child_from_point( HWND parent, POINT pt, INT *hittest, LPARAM lparam )
292 int i, res;
293 LONG style, exstyle;
294 RECT rectWindow, rectClient;
295 WND *wndPtr;
296 HWND *list = WIN_ListChildren( parent );
297 HWND retvalue = 0;
299 if (!list) return 0;
300 for (i = 0; list[i]; i++)
302 /* If point is in window, and window is visible, and it */
303 /* is enabled (or it's a top-level window), then explore */
304 /* its children. Otherwise, go to the next window. */
306 style = GetWindowLongW( list[i], GWL_STYLE );
307 if (!(style & WS_VISIBLE)) continue; /* not visible -> skip */
308 if ((style & (WS_POPUP | WS_CHILD | WS_DISABLED)) == (WS_CHILD | WS_DISABLED))
309 continue; /* disabled child -> skip */
310 exstyle = GetWindowLongW( list[i], GWL_EXSTYLE );
311 if ((exstyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) == (WS_EX_LAYERED | WS_EX_TRANSPARENT))
312 continue; /* transparent -> skip */
314 if (!WIN_GetRectangles( list[i], &rectWindow, &rectClient )) continue;
315 if (!PtInRect( &rectWindow, pt )) continue; /* not in window -> skip */
317 /* FIXME: check window region for other processes too */
318 if ((wndPtr = WIN_GetPtr( list[i] )) && wndPtr != WND_OTHER_PROCESS)
320 if (wndPtr->hrgnWnd && !PtInRegion( wndPtr->hrgnWnd,
321 pt.x - rectWindow.left, pt.y - rectWindow.top ))
323 WIN_ReleasePtr( wndPtr );
324 continue; /* point outside window region -> skip */
326 WIN_ReleasePtr( wndPtr );
329 /* If window is minimized or disabled, return at once */
330 if (style & WS_MINIMIZE)
332 *hittest = HTCAPTION;
333 retvalue = list[i];
334 break;
336 if (style & WS_DISABLED)
338 *hittest = HTERROR;
339 retvalue = list[i];
340 break;
343 /* If point is in client area, explore children */
344 if (PtInRect( &rectClient, pt ))
346 POINT new_pt;
348 new_pt.x = pt.x - rectClient.left;
349 new_pt.y = pt.y - rectClient.top;
350 if ((retvalue = find_child_from_point( list[i], new_pt, hittest, lparam ))) break;
353 /* Now it's inside window, send WM_NCCHITTEST (if same thread) */
354 if (!WIN_IsCurrentThread( list[i] ))
356 *hittest = HTCLIENT;
357 retvalue = list[i];
358 break;
360 if ((res = SendMessageA( list[i], WM_NCHITTEST, 0, lparam )) != HTTRANSPARENT)
362 *hittest = res; /* Found the window */
363 retvalue = list[i];
364 break;
366 /* continue search with next sibling */
368 HeapFree( GetProcessHeap(), 0, list );
369 return retvalue;
373 /***********************************************************************
374 * WINPOS_WindowFromPoint
376 * Find the window and hittest for a given point.
378 HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest )
380 POINT xy = pt;
381 int res;
382 LONG style;
384 TRACE("scope %p %ld,%ld\n", hwndScope, pt.x, pt.y);
386 if (!hwndScope) hwndScope = GetDesktopWindow();
387 style = GetWindowLongW( hwndScope, GWL_STYLE );
389 *hittest = HTERROR;
390 if (style & WS_DISABLED) return 0;
392 MapWindowPoints( GetDesktopWindow(), GetAncestor( hwndScope, GA_PARENT ), &xy, 1 );
394 if (!(style & WS_MINIMIZE))
396 RECT rectClient;
397 if (WIN_GetRectangles( hwndScope, NULL, &rectClient ) && PtInRect( &rectClient, xy ))
399 HWND ret;
401 xy.x -= rectClient.left;
402 xy.y -= rectClient.top;
403 if ((ret = find_child_from_point( hwndScope, xy, hittest, MAKELONG( pt.x, pt.y ) )))
405 TRACE( "found child %p\n", ret );
406 return ret;
411 /* If nothing found, try the scope window */
412 if (!WIN_IsCurrentThread( hwndScope ))
414 *hittest = HTCLIENT;
415 TRACE( "returning %p\n", hwndScope );
416 return hwndScope;
418 res = SendMessageA( hwndScope, WM_NCHITTEST, 0, MAKELONG( pt.x, pt.y ) );
419 if (res != HTTRANSPARENT)
421 *hittest = res; /* Found the window */
422 TRACE( "returning %p\n", hwndScope );
423 return hwndScope;
425 *hittest = HTNOWHERE;
426 TRACE( "nothing found\n" );
427 return 0;
431 /*******************************************************************
432 * WindowFromPoint (USER32.@)
434 HWND WINAPI WindowFromPoint( POINT pt )
436 INT hittest;
437 return WINPOS_WindowFromPoint( 0, pt, &hittest );
441 /*******************************************************************
442 * ChildWindowFromPoint (USER32.@)
444 HWND WINAPI ChildWindowFromPoint( HWND hwndParent, POINT pt )
446 return ChildWindowFromPointEx( hwndParent, pt, CWP_ALL );
449 /*******************************************************************
450 * ChildWindowFromPointEx (USER32.@)
452 HWND WINAPI ChildWindowFromPointEx( HWND hwndParent, POINT pt, UINT uFlags)
454 /* pt is in the client coordinates */
455 HWND *list;
456 int i;
457 RECT rect;
458 HWND retvalue;
460 GetClientRect( hwndParent, &rect );
461 if (!PtInRect( &rect, pt )) return 0;
462 if (!(list = WIN_ListChildren( hwndParent ))) return 0;
464 for (i = 0; list[i]; i++)
466 if (!WIN_GetRectangles( list[i], &rect, NULL )) continue;
467 if (!PtInRect( &rect, pt )) continue;
468 if (uFlags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED))
470 LONG style = GetWindowLongW( list[i], GWL_STYLE );
471 if ((uFlags & CWP_SKIPINVISIBLE) && !(style & WS_VISIBLE)) continue;
472 if ((uFlags & CWP_SKIPDISABLED) && (style & WS_DISABLED)) continue;
474 if (uFlags & CWP_SKIPTRANSPARENT)
476 if (GetWindowLongW( list[i], GWL_EXSTYLE ) & WS_EX_TRANSPARENT) continue;
478 break;
480 retvalue = list[i];
481 HeapFree( GetProcessHeap(), 0, list );
482 if (!retvalue) retvalue = hwndParent;
483 return retvalue;
487 /*******************************************************************
488 * WINPOS_GetWinOffset
490 * Calculate the offset between the origin of the two windows. Used
491 * to implement MapWindowPoints.
493 static void WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, POINT *offset )
495 WND * wndPtr;
497 offset->x = offset->y = 0;
499 /* Translate source window origin to screen coords */
500 if (hwndFrom)
502 HWND hwnd = hwndFrom;
504 while (hwnd)
506 if (hwnd == hwndTo) return;
507 if (!(wndPtr = WIN_GetPtr( hwnd )))
509 ERR( "bad hwndFrom = %p\n", hwnd );
510 return;
512 if (wndPtr == WND_OTHER_PROCESS) goto other_process;
513 offset->x += wndPtr->rectClient.left;
514 offset->y += wndPtr->rectClient.top;
515 hwnd = wndPtr->parent;
516 WIN_ReleasePtr( wndPtr );
520 /* Translate origin to destination window coords */
521 if (hwndTo)
523 HWND hwnd = hwndTo;
525 while (hwnd)
527 if (!(wndPtr = WIN_GetPtr( hwnd )))
529 ERR( "bad hwndTo = %p\n", hwnd );
530 return;
532 if (wndPtr == WND_OTHER_PROCESS) goto other_process;
533 offset->x -= wndPtr->rectClient.left;
534 offset->y -= wndPtr->rectClient.top;
535 hwnd = wndPtr->parent;
536 WIN_ReleasePtr( wndPtr );
539 return;
541 other_process: /* one of the parents may belong to another process, do it the hard way */
542 offset->x = offset->y = 0;
543 SERVER_START_REQ( get_windows_offset )
545 req->from = hwndFrom;
546 req->to = hwndTo;
547 if (!wine_server_call( req ))
549 offset->x = reply->x;
550 offset->y = reply->y;
553 SERVER_END_REQ;
557 /*******************************************************************
558 * MapWindowPoints (USER.258)
560 void WINAPI MapWindowPoints16( HWND16 hwndFrom, HWND16 hwndTo,
561 LPPOINT16 lppt, UINT16 count )
563 POINT offset;
565 WINPOS_GetWinOffset( WIN_Handle32(hwndFrom), WIN_Handle32(hwndTo), &offset );
566 while (count--)
568 lppt->x += offset.x;
569 lppt->y += offset.y;
570 lppt++;
575 /*******************************************************************
576 * MapWindowPoints (USER32.@)
578 INT WINAPI MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, UINT count )
580 POINT offset;
582 WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset );
583 while (count--)
585 lppt->x += offset.x;
586 lppt->y += offset.y;
587 lppt++;
589 return MAKELONG( LOWORD(offset.x), LOWORD(offset.y) );
593 /***********************************************************************
594 * IsIconic (USER32.@)
596 BOOL WINAPI IsIconic(HWND hWnd)
598 return (GetWindowLongW( hWnd, GWL_STYLE ) & WS_MINIMIZE) != 0;
602 /***********************************************************************
603 * IsZoomed (USER32.@)
605 BOOL WINAPI IsZoomed(HWND hWnd)
607 return (GetWindowLongW( hWnd, GWL_STYLE ) & WS_MAXIMIZE) != 0;
611 /*******************************************************************
612 * AllowSetForegroundWindow (USER32.@)
614 BOOL WINAPI AllowSetForegroundWindow( DWORD procid )
616 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
617 * implemented, then fix this function. */
618 return TRUE;
622 /*******************************************************************
623 * LockSetForegroundWindow (USER32.@)
625 BOOL WINAPI LockSetForegroundWindow( UINT lockcode )
627 /* FIXME: If Win98/2000 style SetForegroundWindow behavior is
628 * implemented, then fix this function. */
629 return TRUE;
633 /*******************************************************************
634 * SetShellWindow (USER32.@)
636 HWND WINAPI SetShellWindow(HWND hwndshell)
637 { WARN("(hWnd=%p) semi stub\n",hwndshell );
639 hGlobalShellWindow = WIN_GetFullHandle( hwndshell );
640 return hGlobalShellWindow;
644 /*******************************************************************
645 * GetShellWindow (USER32.@)
647 HWND WINAPI GetShellWindow(void)
648 { WARN("(hWnd=%p) semi stub\n",hGlobalShellWindow );
650 return hGlobalShellWindow;
654 /***********************************************************************
655 * BringWindowToTop (USER32.@)
657 BOOL WINAPI BringWindowToTop( HWND hwnd )
659 return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
663 /***********************************************************************
664 * MoveWindow (USER32.@)
666 BOOL WINAPI MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
667 BOOL repaint )
669 int flags = SWP_NOZORDER | SWP_NOACTIVATE;
670 if (!repaint) flags |= SWP_NOREDRAW;
671 TRACE("%p %d,%d %dx%d %d\n", hwnd, x, y, cx, cy, repaint );
672 return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
675 /***********************************************************************
676 * WINPOS_InitInternalPos
678 static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT pt, const RECT *restoreRect )
680 LPINTERNALPOS lpPos = (LPINTERNALPOS) GetPropA( wnd->hwndSelf,
681 atomInternalPos );
682 if( !lpPos )
684 /* this happens when the window is minimized/maximized
685 * for the first time (rectWindow is not adjusted yet) */
687 lpPos = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNALPOS) );
688 if( !lpPos ) return NULL;
690 SetPropA( wnd->hwndSelf, atomInternalPos, (HANDLE)lpPos );
691 lpPos->hwndIconTitle = 0; /* defer until needs to be shown */
692 CONV_RECT32TO16( &wnd->rectWindow, &lpPos->rectNormal );
693 *(UINT*)&lpPos->ptIconPos = *(UINT*)&lpPos->ptMaxPos = 0xFFFFFFFF;
696 if( wnd->dwStyle & WS_MINIMIZE )
697 CONV_POINT32TO16( &pt, &lpPos->ptIconPos );
698 else if( wnd->dwStyle & WS_MAXIMIZE )
699 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
700 else if( restoreRect )
701 CONV_RECT32TO16( restoreRect, &lpPos->rectNormal );
703 return lpPos;
706 /***********************************************************************
707 * WINPOS_RedrawIconTitle
709 BOOL WINPOS_RedrawIconTitle( HWND hWnd )
711 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hWnd, atomInternalPos );
712 if( lpPos )
714 if( lpPos->hwndIconTitle )
716 SendMessageA( lpPos->hwndIconTitle, WM_SHOWWINDOW, TRUE, 0);
717 InvalidateRect( lpPos->hwndIconTitle, NULL, TRUE );
718 return TRUE;
721 return FALSE;
724 /***********************************************************************
725 * WINPOS_ShowIconTitle
727 BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow )
729 LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
731 if( lpPos && !(GetWindowLongA( hwnd, GWL_EXSTYLE) & WS_EX_MANAGED))
733 HWND title = lpPos->hwndIconTitle;
735 TRACE("%p %i\n", hwnd, (bShow != 0) );
737 if( !title )
738 lpPos->hwndIconTitle = title = ICONTITLE_Create( hwnd );
739 if( bShow )
741 if (!IsWindowVisible(title))
743 SendMessageA( title, WM_SHOWWINDOW, TRUE, 0 );
744 SetWindowPos( title, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
745 SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
748 else ShowWindow( title, SW_HIDE );
750 return FALSE;
753 /*******************************************************************
754 * WINPOS_GetMinMaxInfo
756 * Get the minimized and maximized information for a window.
758 void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
759 POINT *minTrack, POINT *maxTrack )
761 LPINTERNALPOS lpPos;
762 MINMAXINFO MinMax;
763 INT xinc, yinc;
764 LONG style = GetWindowLongA( hwnd, GWL_STYLE );
765 LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
767 /* Compute default values */
769 MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);
770 MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);
771 MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
772 MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
773 MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
774 MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
776 if (HAS_DLGFRAME( style, exstyle ))
778 xinc = GetSystemMetrics(SM_CXDLGFRAME);
779 yinc = GetSystemMetrics(SM_CYDLGFRAME);
781 else
783 xinc = yinc = 0;
784 if (HAS_THICKFRAME(style))
786 xinc += GetSystemMetrics(SM_CXFRAME);
787 yinc += GetSystemMetrics(SM_CYFRAME);
789 if (style & WS_BORDER)
791 xinc += GetSystemMetrics(SM_CXBORDER);
792 yinc += GetSystemMetrics(SM_CYBORDER);
795 MinMax.ptMaxSize.x += 2 * xinc;
796 MinMax.ptMaxSize.y += 2 * yinc;
798 lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
799 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
800 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
801 else
803 MinMax.ptMaxPosition.x = -xinc;
804 MinMax.ptMaxPosition.y = -yinc;
807 SendMessageA( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
809 /* Some sanity checks */
811 TRACE("%ld %ld / %ld %ld / %ld %ld / %ld %ld\n",
812 MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,
813 MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
814 MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
815 MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y);
816 MinMax.ptMaxTrackSize.x = max( MinMax.ptMaxTrackSize.x,
817 MinMax.ptMinTrackSize.x );
818 MinMax.ptMaxTrackSize.y = max( MinMax.ptMaxTrackSize.y,
819 MinMax.ptMinTrackSize.y );
821 if (maxSize) *maxSize = MinMax.ptMaxSize;
822 if (maxPos) *maxPos = MinMax.ptMaxPosition;
823 if (minTrack) *minTrack = MinMax.ptMinTrackSize;
824 if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize;
827 /***********************************************************************
828 * ShowWindowAsync (USER32.@)
830 * doesn't wait; returns immediately.
831 * used by threads to toggle windows in other (possibly hanging) threads
833 BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd )
835 HWND full_handle;
837 if (is_broadcast(hwnd))
839 SetLastError( ERROR_INVALID_PARAMETER );
840 return FALSE;
843 if ((full_handle = WIN_IsCurrentThread( hwnd )))
844 return USER_Driver.pShowWindow( full_handle, cmd );
845 return SendNotifyMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
849 /***********************************************************************
850 * ShowWindow (USER32.@)
852 BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
854 HWND full_handle;
856 if (is_broadcast(hwnd))
858 SetLastError( ERROR_INVALID_PARAMETER );
859 return FALSE;
861 if ((full_handle = WIN_IsCurrentThread( hwnd )))
863 if (USER_Driver.pShowWindow)
864 return USER_Driver.pShowWindow( full_handle, cmd );
865 return FALSE;
867 return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
871 /***********************************************************************
872 * GetInternalWindowPos (USER32.@)
874 UINT WINAPI GetInternalWindowPos( HWND hwnd, LPRECT rectWnd,
875 LPPOINT ptIcon )
877 WINDOWPLACEMENT wndpl;
878 if (GetWindowPlacement( hwnd, &wndpl ))
880 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
881 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
882 return wndpl.showCmd;
884 return 0;
888 /***********************************************************************
889 * GetWindowPlacement (USER32.@)
891 * Win95:
892 * Fails if wndpl->length of Win95 (!) apps is invalid.
894 BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
896 WND *pWnd = WIN_FindWndPtr( hwnd );
897 LPINTERNALPOS lpPos;
899 if(!pWnd ) return FALSE;
901 lpPos = WINPOS_InitInternalPos( pWnd, *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
902 wndpl->length = sizeof(*wndpl);
903 if( pWnd->dwStyle & WS_MINIMIZE )
904 wndpl->showCmd = SW_SHOWMINIMIZED;
905 else
906 wndpl->showCmd = ( pWnd->dwStyle & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
907 if( pWnd->flags & WIN_RESTORE_MAX )
908 wndpl->flags = WPF_RESTORETOMAXIMIZED;
909 else
910 wndpl->flags = 0;
911 CONV_POINT16TO32( &lpPos->ptIconPos, &wndpl->ptMinPosition );
912 CONV_POINT16TO32( &lpPos->ptMaxPos, &wndpl->ptMaxPosition );
913 CONV_RECT16TO32( &lpPos->rectNormal, &wndpl->rcNormalPosition );
914 WIN_ReleaseWndPtr(pWnd);
915 return TRUE;
919 /***********************************************************************
920 * WINPOS_SetPlacement
922 static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT flags )
924 WND *pWnd = WIN_FindWndPtr( hwnd );
925 if( pWnd )
927 LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd,
928 *(LPPOINT)&pWnd->rectWindow.left, &pWnd->rectWindow );
930 if( flags & PLACE_MIN ) CONV_POINT32TO16( &wndpl->ptMinPosition, &lpPos->ptIconPos );
931 if( flags & PLACE_MAX ) CONV_POINT32TO16( &wndpl->ptMaxPosition, &lpPos->ptMaxPos );
932 if( flags & PLACE_RECT) CONV_RECT32TO16( &wndpl->rcNormalPosition, &lpPos->rectNormal );
934 if( pWnd->dwStyle & WS_MINIMIZE )
936 WINPOS_ShowIconTitle( pWnd->hwndSelf, FALSE );
937 if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
938 SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
939 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
941 else if( pWnd->dwStyle & WS_MAXIMIZE )
943 if( !EMPTYPOINT(lpPos->ptMaxPos) )
944 SetWindowPos( hwnd, 0, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
945 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
947 else if( flags & PLACE_RECT )
948 SetWindowPos( hwnd, 0, lpPos->rectNormal.left, lpPos->rectNormal.top,
949 lpPos->rectNormal.right - lpPos->rectNormal.left,
950 lpPos->rectNormal.bottom - lpPos->rectNormal.top,
951 SWP_NOZORDER | SWP_NOACTIVATE );
953 ShowWindow( hwnd, wndpl->showCmd );
954 if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
956 if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd->hwndSelf, TRUE );
958 /* SDK: ...valid only the next time... */
959 if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
961 WIN_ReleaseWndPtr(pWnd);
962 return TRUE;
964 return FALSE;
968 /***********************************************************************
969 * SetWindowPlacement (USER32.@)
971 * Win95:
972 * Fails if wndpl->length of Win95 (!) apps is invalid.
974 BOOL WINAPI SetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *wpl )
976 if (!wpl) return FALSE;
977 return WINPOS_SetPlacement( hwnd, wpl, PLACE_MIN | PLACE_MAX | PLACE_RECT );
981 /***********************************************************************
982 * AnimateWindow (USER32.@)
983 * Shows/Hides a window with an animation
984 * NO ANIMATION YET
986 BOOL WINAPI AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags)
988 FIXME("partial stub\n");
990 /* If trying to show/hide and it's already *
991 * shown/hidden or invalid window, fail with *
992 * invalid parameter */
993 if(!IsWindow(hwnd) ||
994 (IsWindowVisible(hwnd) && !(dwFlags & AW_HIDE)) ||
995 (!IsWindowVisible(hwnd) && (dwFlags & AW_HIDE)))
997 SetLastError(ERROR_INVALID_PARAMETER);
998 return FALSE;
1001 ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
1003 return TRUE;
1006 /***********************************************************************
1007 * SetInternalWindowPos (USER32.@)
1009 void WINAPI SetInternalWindowPos( HWND hwnd, UINT showCmd,
1010 LPRECT rect, LPPOINT pt )
1012 if( IsWindow(hwnd) )
1014 WINDOWPLACEMENT wndpl;
1015 UINT flags;
1017 wndpl.length = sizeof(wndpl);
1018 wndpl.showCmd = showCmd;
1019 wndpl.flags = flags = 0;
1021 if( pt )
1023 flags |= PLACE_MIN;
1024 wndpl.flags |= WPF_SETMINPOSITION;
1025 wndpl.ptMinPosition = *pt;
1027 if( rect )
1029 flags |= PLACE_RECT;
1030 wndpl.rcNormalPosition = *rect;
1032 WINPOS_SetPlacement( hwnd, &wndpl, flags );
1037 /*******************************************************************
1038 * can_activate_window
1040 * Check if we can activate the specified window.
1042 static BOOL can_activate_window( HWND hwnd )
1044 LONG style;
1046 if (!hwnd) return FALSE;
1047 style = GetWindowLongW( hwnd, GWL_STYLE );
1048 if (!(style & WS_VISIBLE)) return FALSE;
1049 if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
1050 return !(style & WS_DISABLED);
1054 /*******************************************************************
1055 * WINPOS_ActivateOtherWindow
1057 * Activates window other than pWnd.
1059 void WINPOS_ActivateOtherWindow(HWND hwnd)
1061 HWND hwndTo, fg;
1063 if ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo = GetWindow( hwnd, GW_OWNER )))
1065 hwndTo = GetAncestor( hwndTo, GA_ROOT );
1066 if (can_activate_window( hwndTo )) goto done;
1069 hwndTo = hwnd;
1070 for (;;)
1072 if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
1073 if (can_activate_window( hwndTo )) break;
1076 done:
1077 fg = GetForegroundWindow();
1078 TRACE("win = %p fg = %p\n", hwndTo, fg);
1079 if (!fg || (hwnd == fg))
1081 if (SetForegroundWindow( hwndTo )) return;
1083 if (!SetActiveWindow( hwndTo )) SetActiveWindow(0);
1087 /***********************************************************************
1088 * WINPOS_HandleWindowPosChanging16
1090 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1092 LONG WINPOS_HandleWindowPosChanging16( HWND hwnd, WINDOWPOS16 *winpos )
1094 POINT maxSize, minTrack;
1095 LONG style = GetWindowLongA( hwnd, GWL_STYLE );
1097 if (winpos->flags & SWP_NOSIZE) return 0;
1098 if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
1100 WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
1101 if (maxSize.x < winpos->cx) winpos->cx = maxSize.x;
1102 if (maxSize.y < winpos->cy) winpos->cy = maxSize.y;
1103 if (!(style & WS_MINIMIZE))
1105 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1106 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1109 return 0;
1113 /***********************************************************************
1114 * WINPOS_HandleWindowPosChanging
1116 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
1118 LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos )
1120 POINT maxSize, minTrack;
1121 LONG style = GetWindowLongA( hwnd, GWL_STYLE );
1123 if (winpos->flags & SWP_NOSIZE) return 0;
1124 if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
1126 WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
1127 winpos->cx = min( winpos->cx, maxSize.x );
1128 winpos->cy = min( winpos->cy, maxSize.y );
1129 if (!(style & WS_MINIMIZE))
1131 if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
1132 if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
1135 return 0;
1139 /***********************************************************************
1140 * dump_winpos_flags
1142 static void dump_winpos_flags(UINT flags)
1144 TRACE("flags:");
1145 if(flags & SWP_NOSIZE) TRACE(" SWP_NOSIZE");
1146 if(flags & SWP_NOMOVE) TRACE(" SWP_NOMOVE");
1147 if(flags & SWP_NOZORDER) TRACE(" SWP_NOZORDER");
1148 if(flags & SWP_NOREDRAW) TRACE(" SWP_NOREDRAW");
1149 if(flags & SWP_NOACTIVATE) TRACE(" SWP_NOACTIVATE");
1150 if(flags & SWP_FRAMECHANGED) TRACE(" SWP_FRAMECHANGED");
1151 if(flags & SWP_SHOWWINDOW) TRACE(" SWP_SHOWWINDOW");
1152 if(flags & SWP_HIDEWINDOW) TRACE(" SWP_HIDEWINDOW");
1153 if(flags & SWP_NOCOPYBITS) TRACE(" SWP_NOCOPYBITS");
1154 if(flags & SWP_NOOWNERZORDER) TRACE(" SWP_NOOWNERZORDER");
1155 if(flags & SWP_NOSENDCHANGING) TRACE(" SWP_NOSENDCHANGING");
1156 if(flags & SWP_DEFERERASE) TRACE(" SWP_DEFERERASE");
1157 if(flags & SWP_ASYNCWINDOWPOS) TRACE(" SWP_ASYNCWINDOWPOS");
1159 #define DUMPED_FLAGS \
1160 (SWP_NOSIZE | \
1161 SWP_NOMOVE | \
1162 SWP_NOZORDER | \
1163 SWP_NOREDRAW | \
1164 SWP_NOACTIVATE | \
1165 SWP_FRAMECHANGED | \
1166 SWP_SHOWWINDOW | \
1167 SWP_HIDEWINDOW | \
1168 SWP_NOCOPYBITS | \
1169 SWP_NOOWNERZORDER | \
1170 SWP_NOSENDCHANGING | \
1171 SWP_DEFERERASE | \
1172 SWP_ASYNCWINDOWPOS)
1174 if(flags & ~DUMPED_FLAGS) TRACE(" %08x", flags & ~DUMPED_FLAGS);
1175 TRACE("\n");
1176 #undef DUMPED_FLAGS
1179 /***********************************************************************
1180 * SetWindowPos (USER32.@)
1182 BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
1183 INT x, INT y, INT cx, INT cy, UINT flags )
1185 WINDOWPOS winpos;
1187 TRACE("hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
1188 hwnd, hwndInsertAfter, x, y, cx, cy, flags);
1189 if(TRACE_ON(win)) dump_winpos_flags(flags);
1191 if (is_broadcast(hwnd))
1193 SetLastError( ERROR_INVALID_PARAMETER );
1194 return FALSE;
1197 winpos.hwnd = WIN_GetFullHandle(hwnd);
1198 winpos.hwndInsertAfter = WIN_GetFullHandle(hwndInsertAfter);
1199 winpos.x = x;
1200 winpos.y = y;
1201 winpos.cx = cx;
1202 winpos.cy = cy;
1203 winpos.flags = flags;
1204 if (WIN_IsCurrentThread( hwnd )) return USER_Driver.pSetWindowPos( &winpos );
1205 return SendMessageW( winpos.hwnd, WM_WINE_SETWINDOWPOS, 0, (LPARAM)&winpos );
1209 /***********************************************************************
1210 * BeginDeferWindowPos (USER32.@)
1212 HDWP WINAPI BeginDeferWindowPos( INT count )
1214 HDWP handle;
1215 DWP *pDWP;
1217 if (count < 0)
1219 SetLastError(ERROR_INVALID_PARAMETER);
1220 return 0;
1222 /* Windows allows zero count, in which case it allocates context for 8 moves */
1223 if (count == 0) count = 8;
1225 handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
1226 if (!handle) return 0;
1227 pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle );
1228 pDWP->actualCount = 0;
1229 pDWP->suggestedCount = count;
1230 pDWP->valid = TRUE;
1231 pDWP->wMagic = DWP_MAGIC;
1232 pDWP->hwndParent = 0;
1233 return handle;
1237 /***********************************************************************
1238 * DeferWindowPos (USER32.@)
1240 HDWP WINAPI DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
1241 INT x, INT y, INT cx, INT cy,
1242 UINT flags )
1244 DWP *pDWP;
1245 int i;
1246 HDWP newhdwp = hdwp,retvalue;
1248 hwnd = WIN_GetFullHandle( hwnd );
1249 if (hwnd == GetDesktopWindow()) return 0;
1251 if (!(pDWP = USER_HEAP_LIN_ADDR( hdwp ))) return 0;
1253 USER_Lock();
1255 for (i = 0; i < pDWP->actualCount; i++)
1257 if (pDWP->winPos[i].hwnd == hwnd)
1259 /* Merge with the other changes */
1260 if (!(flags & SWP_NOZORDER))
1262 pDWP->winPos[i].hwndInsertAfter = WIN_GetFullHandle(hwndAfter);
1264 if (!(flags & SWP_NOMOVE))
1266 pDWP->winPos[i].x = x;
1267 pDWP->winPos[i].y = y;
1269 if (!(flags & SWP_NOSIZE))
1271 pDWP->winPos[i].cx = cx;
1272 pDWP->winPos[i].cy = cy;
1274 pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
1275 SWP_NOZORDER | SWP_NOREDRAW |
1276 SWP_NOACTIVATE | SWP_NOCOPYBITS|
1277 SWP_NOOWNERZORDER);
1278 pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
1279 SWP_FRAMECHANGED);
1280 retvalue = hdwp;
1281 goto END;
1284 if (pDWP->actualCount >= pDWP->suggestedCount)
1286 newhdwp = USER_HEAP_REALLOC( hdwp,
1287 sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS) );
1288 if (!newhdwp)
1290 retvalue = 0;
1291 goto END;
1293 pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp );
1294 pDWP->suggestedCount++;
1296 pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
1297 pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
1298 pDWP->winPos[pDWP->actualCount].x = x;
1299 pDWP->winPos[pDWP->actualCount].y = y;
1300 pDWP->winPos[pDWP->actualCount].cx = cx;
1301 pDWP->winPos[pDWP->actualCount].cy = cy;
1302 pDWP->winPos[pDWP->actualCount].flags = flags;
1303 pDWP->actualCount++;
1304 retvalue = newhdwp;
1305 END:
1306 USER_Unlock();
1307 return retvalue;
1311 /***********************************************************************
1312 * EndDeferWindowPos (USER32.@)
1314 BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
1316 DWP *pDWP;
1317 WINDOWPOS *winpos;
1318 BOOL res = TRUE;
1319 int i;
1321 pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
1322 if (!pDWP) return FALSE;
1323 for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
1325 if (!(res = USER_Driver.pSetWindowPos( winpos ))) break;
1327 USER_HEAP_FREE( hdwp );
1328 return res;
1332 /***********************************************************************
1333 * TileChildWindows (USER.199)
1335 void WINAPI TileChildWindows16( HWND16 parent, WORD action )
1337 FIXME("(%04x, %d): stub\n", parent, action);
1340 /***********************************************************************
1341 * CascadeChildWindows (USER.198)
1343 void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
1345 FIXME("(%04x, %d): stub\n", parent, action);
1348 /***********************************************************************
1349 * SetProgmanWindow (USER32.@)
1351 HWND WINAPI SetProgmanWindow ( HWND hwnd )
1353 hGlobalProgmanWindow = hwnd;
1354 return hGlobalProgmanWindow;
1357 /***********************************************************************
1358 * GetProgmanWindow (USER32.@)
1360 HWND WINAPI GetProgmanWindow(void)
1362 return hGlobalProgmanWindow;
1365 /***********************************************************************
1366 * SetShellWindowEx (USER32.@)
1367 * hwndProgman = Progman[Program Manager]
1368 * |-> SHELLDLL_DefView
1369 * hwndListView = | |-> SysListView32
1370 * | | |-> tooltips_class32
1371 * | |
1372 * | |-> SysHeader32
1374 * |-> ProxyTarget
1376 HWND WINAPI SetShellWindowEx ( HWND hwndProgman, HWND hwndListView )
1378 FIXME("%p %p stub\n",hwndProgman ,hwndListView );
1379 hGlobalShellWindow = hwndProgman;
1380 return hGlobalShellWindow;
1384 /***********************************************************************
1385 * SetTaskmanWindow (USER32.@)
1386 * NOTES
1387 * hwnd = MSTaskSwWClass
1388 * |-> SysTabControl32
1390 HWND WINAPI SetTaskmanWindow ( HWND hwnd )
1392 hGlobalTaskmanWindow = hwnd;
1393 return hGlobalTaskmanWindow;
1396 /***********************************************************************
1397 * GetTaskmanWindow (USER32.@)
1399 HWND WINAPI GetTaskmanWindow(void)
1401 return hGlobalTaskmanWindow;