2 * 16-bit windowing functions
4 * Copyright 2001 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "wine/winuser16.h"
25 #include "stackframe.h"
27 /* handle <--> handle16 conversions */
28 #define HANDLE_16(h32) (LOWORD(h32))
29 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
31 static HWND16 hwndSysModal;
39 /* callback for 16-bit window enumeration functions */
40 static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param )
42 const struct wnd_enum_info *info = (struct wnd_enum_info *)param;
46 args[2] = HWND_16(hwnd);
47 args[1] = HIWORD(info->param);
48 args[0] = LOWORD(info->param);
49 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
53 /* convert insert after window handle to 32-bit */
54 inline static HWND full_insert_after_hwnd( HWND16 hwnd )
56 HWND ret = WIN_Handle32( hwnd );
57 if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
61 /**************************************************************************
64 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
66 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
70 /**************************************************************************
73 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
75 return KillTimer( WIN_Handle32(hwnd), id );
79 /**************************************************************************
80 * SetCapture (USER.18)
82 HWND16 WINAPI SetCapture16( HWND16 hwnd )
84 return HWND_16( SetCapture( WIN_Handle32(hwnd) ));
88 /**************************************************************************
89 * ReleaseCapture (USER.19)
91 BOOL16 WINAPI ReleaseCapture16(void)
93 return ReleaseCapture();
97 /**************************************************************************
100 HWND16 WINAPI SetFocus16( HWND16 hwnd )
102 return HWND_16( SetFocus( WIN_Handle32(hwnd) ));
106 /**************************************************************************
109 HWND16 WINAPI GetFocus16(void)
111 return HWND_16( GetFocus() );
115 /**************************************************************************
116 * RemoveProp (USER.24)
118 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
120 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd), str ));
124 /**************************************************************************
127 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
129 return HANDLE_16(GetPropA( WIN_Handle32(hwnd), str ));
133 /**************************************************************************
136 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
138 return SetPropA( WIN_Handle32(hwnd), str, HANDLE_32(handle) );
142 /**************************************************************************
143 * ClientToScreen (USER.28)
145 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
147 MapWindowPoints16( hwnd, 0, lppnt, 1 );
151 /**************************************************************************
152 * ScreenToClient (USER.29)
154 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
156 MapWindowPoints16( 0, hwnd, lppnt, 1 );
160 /**************************************************************************
161 * WindowFromPoint (USER.30)
163 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
169 return HWND_16( WindowFromPoint( pt32 ) );
173 /**************************************************************************
176 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
178 return IsIconic( WIN_Handle32(hwnd) );
182 /**************************************************************************
183 * GetWindowRect (USER.32)
185 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
189 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
190 rect->left = rect32.left;
191 rect->top = rect32.top;
192 rect->right = rect32.right;
193 rect->bottom = rect32.bottom;
197 /**************************************************************************
198 * GetClientRect (USER.33)
200 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
204 GetClientRect( WIN_Handle32(hwnd), &rect32 );
205 rect->left = rect32.left;
206 rect->top = rect32.top;
207 rect->right = rect32.right;
208 rect->bottom = rect32.bottom;
212 /**************************************************************************
213 * EnableWindow (USER.34)
215 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
217 return EnableWindow( WIN_Handle32(hwnd), enable );
221 /**************************************************************************
222 * IsWindowEnabled (USER.35)
224 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
226 return IsWindowEnabled( WIN_Handle32(hwnd) );
230 /**************************************************************************
231 * GetWindowText (USER.36)
233 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
235 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
239 /**************************************************************************
240 * SetWindowText (USER.37)
242 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
244 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
248 /**************************************************************************
249 * GetWindowTextLength (USER.38)
251 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
253 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
257 /***********************************************************************
258 * BeginPaint (USER.39)
260 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
264 BeginPaint( WIN_Handle32(hwnd), &ps );
265 lps->hdc = HDC_16(ps.hdc);
266 lps->fErase = ps.fErase;
267 lps->rcPaint.top = ps.rcPaint.top;
268 lps->rcPaint.left = ps.rcPaint.left;
269 lps->rcPaint.right = ps.rcPaint.right;
270 lps->rcPaint.bottom = ps.rcPaint.bottom;
271 lps->fRestore = ps.fRestore;
272 lps->fIncUpdate = ps.fIncUpdate;
277 /***********************************************************************
280 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
284 ps.hdc = HDC_32(lps->hdc);
285 return EndPaint( WIN_Handle32(hwnd), &ps );
289 /**************************************************************************
290 * ShowWindow (USER.42)
292 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
294 return ShowWindow( WIN_Handle32(hwnd), cmd );
298 /**************************************************************************
299 * CloseWindow (USER.43)
301 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
303 return CloseWindow( WIN_Handle32(hwnd) );
307 /**************************************************************************
310 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
312 return OpenIcon( WIN_Handle32(hwnd) );
316 /**************************************************************************
317 * BringWindowToTop (USER.45)
319 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
321 return BringWindowToTop( WIN_Handle32(hwnd) );
325 /**************************************************************************
326 * GetParent (USER.46)
328 HWND16 WINAPI GetParent16( HWND16 hwnd )
330 return HWND_16( GetParent( WIN_Handle32(hwnd) ));
334 /**************************************************************************
337 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
339 CURRENT_STACK16->es = USER_HeapSel;
340 /* don't use WIN_Handle32 here, we don't care about the full handle */
341 return IsWindow( HWND_32(hwnd) );
345 /**************************************************************************
348 BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
350 return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
354 /**************************************************************************
355 * IsWindowVisible (USER.49)
357 BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
359 return IsWindowVisible( WIN_Handle32(hwnd) );
363 /**************************************************************************
364 * FindWindow (USER.50)
366 HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
368 return HWND_16( FindWindowA( className, title ));
372 /**************************************************************************
373 * DestroyWindow (USER.53)
375 BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
377 return DestroyWindow( WIN_Handle32(hwnd) );
381 /*******************************************************************
382 * EnumWindows (USER.54)
384 BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
386 struct wnd_enum_info info;
390 return EnumWindows( wnd_enum_callback, (LPARAM)&info );
394 /**********************************************************************
395 * EnumChildWindows (USER.55)
397 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
399 struct wnd_enum_info info;
403 return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info );
407 /**************************************************************************
408 * MoveWindow (USER.56)
410 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
412 return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
416 /**************************************************************************
417 * GetClassName (USER.58)
419 INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
421 return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
425 /**************************************************************************
426 * SetActiveWindow (USER.59)
428 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
430 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd) ));
434 /**************************************************************************
435 * GetActiveWindow (USER.60)
437 HWND16 WINAPI GetActiveWindow16(void)
439 return HWND_16( GetActiveWindow() );
443 /**************************************************************************
444 * ScrollWindow (USER.61)
446 void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
447 const RECT16 *clipRect )
449 RECT rect32, clipRect32;
453 rect32.left = rect->left;
454 rect32.top = rect->top;
455 rect32.right = rect->right;
456 rect32.bottom = rect->bottom;
460 clipRect32.left = clipRect->left;
461 clipRect32.top = clipRect->top;
462 clipRect32.right = clipRect->right;
463 clipRect32.bottom = clipRect->bottom;
465 ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
466 clipRect ? &clipRect32 : NULL );
470 /**************************************************************************
471 * SetScrollPos (USER.62)
473 INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
475 return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
479 /**************************************************************************
480 * GetScrollPos (USER.63)
482 INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
484 return GetScrollPos( WIN_Handle32(hwnd), nBar );
488 /**************************************************************************
489 * SetScrollRange (USER.64)
491 void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
493 /* Invalid range -> range is set to (0,0) */
494 if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
495 SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
499 /**************************************************************************
500 * GetScrollRange (USER.65)
502 BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
505 BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
506 if (lpMin) *lpMin = min;
507 if (lpMax) *lpMax = max;
512 /**************************************************************************
515 HDC16 WINAPI GetDC16( HWND16 hwnd )
517 return HDC_16(GetDC( WIN_Handle32(hwnd) ));
521 /**************************************************************************
522 * GetWindowDC (USER.67)
524 HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
526 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
530 /**************************************************************************
531 * ReleaseDC (USER.68)
533 INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
535 return (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) );
539 /**************************************************************************
540 * FlashWindow (USER.105)
542 BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
544 return FlashWindow( WIN_Handle32(hwnd), bInvert );
548 /**************************************************************************
549 * WindowFromDC (USER.117)
551 HWND16 WINAPI WindowFromDC16( HDC16 hDC )
553 return HWND_16( WindowFromDC( HDC_32(hDC) ) );
557 /**************************************************************************
558 * UpdateWindow (USER.124)
560 void WINAPI UpdateWindow16( HWND16 hwnd )
562 RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
566 /**************************************************************************
567 * InvalidateRect (USER.125)
569 void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
571 RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
575 /**************************************************************************
576 * InvalidateRgn (USER.126)
578 void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
580 RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
584 /**************************************************************************
585 * ValidateRect (USER.127)
587 void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
589 RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
593 /**************************************************************************
594 * ValidateRgn (USER.128)
596 void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
598 RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
602 /**************************************************************************
603 * GetClassWord (USER.129)
605 WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
607 return GetClassWord( WIN_Handle32(hwnd), offset );
611 /**************************************************************************
612 * SetClassWord (USER.130)
614 WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
616 return SetClassWord( WIN_Handle32(hwnd), offset, newval );
620 /**************************************************************************
621 * GetWindowWord (USER.133)
623 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
625 return GetWindowWord( WIN_Handle32(hwnd), offset );
629 /**************************************************************************
630 * SetWindowWord (USER.134)
632 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
634 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
638 /**************************************************************************
639 * OpenClipboard (USER.137)
641 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
643 return OpenClipboard( WIN_Handle32(hwnd) );
647 /**************************************************************************
648 * GetClipboardOwner (USER.140)
650 HWND16 WINAPI GetClipboardOwner16(void)
652 return HWND_16( GetClipboardOwner() );
656 /**************************************************************************
657 * SetClipboardViewer (USER.147)
659 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
661 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd) ));
665 /**************************************************************************
666 * GetClipboardViewer (USER.148)
668 HWND16 WINAPI GetClipboardViewer16(void)
670 return HWND_16( GetClipboardViewer() );
674 /**************************************************************************
675 * ChangeClipboardChain (USER.149)
677 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
679 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
683 /**************************************************************************
684 * GetSystemMenu (USER.156)
686 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
688 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd), revert ));
692 /**************************************************************************
695 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
697 return HMENU_16(GetMenu( WIN_Handle32(hwnd) ));
701 /**************************************************************************
704 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
706 return SetMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
710 /**************************************************************************
711 * DrawMenuBar (USER.160)
713 void WINAPI DrawMenuBar16( HWND16 hwnd )
715 DrawMenuBar( WIN_Handle32(hwnd) );
719 /**************************************************************************
720 * HiliteMenuItem (USER.162)
722 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
724 return HiliteMenuItem( WIN_Handle32(hwnd), HMENU_32(hMenu), id, wHilite );
728 /**************************************************************************
729 * CreateCaret (USER.163)
731 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
733 CreateCaret( WIN_Handle32(hwnd), HBITMAP_32(bitmap), width, height );
737 /*****************************************************************
738 * DestroyCaret (USER.164)
740 void WINAPI DestroyCaret16(void)
746 /*****************************************************************
747 * SetCaretPos (USER.165)
749 void WINAPI SetCaretPos16( INT16 x, INT16 y )
755 /**************************************************************************
756 * HideCaret (USER.166)
758 void WINAPI HideCaret16( HWND16 hwnd )
760 HideCaret( WIN_Handle32(hwnd) );
764 /**************************************************************************
765 * ShowCaret (USER.167)
767 void WINAPI ShowCaret16( HWND16 hwnd )
769 ShowCaret( WIN_Handle32(hwnd) );
773 /*****************************************************************
774 * SetCaretBlinkTime (USER.168)
776 void WINAPI SetCaretBlinkTime16( UINT16 msecs )
778 SetCaretBlinkTime( msecs );
782 /*****************************************************************
783 * GetCaretBlinkTime (USER.169)
785 UINT16 WINAPI GetCaretBlinkTime16(void)
787 return GetCaretBlinkTime();
791 /**************************************************************************
792 * ArrangeIconicWindows (USER.170)
794 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
796 return ArrangeIconicWindows( WIN_Handle32(parent) );
800 /**************************************************************************
801 * SwitchToThisWindow (USER.172)
803 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
805 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
809 /**************************************************************************
810 * KillSystemTimer (USER.182)
812 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
814 return KillSystemTimer( WIN_Handle32(hwnd), id );
818 /*****************************************************************
819 * GetCaretPos (USER.183)
821 void WINAPI GetCaretPos16( LPPOINT16 pt16 )
824 if (GetCaretPos( &pt ))
832 /**************************************************************************
833 * SetSysModalWindow (USER.188)
835 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
837 HWND16 old = hwndSysModal;
843 /**************************************************************************
844 * GetSysModalWindow (USER.189)
846 HWND16 WINAPI GetSysModalWindow16(void)
852 /**************************************************************************
853 * GetUpdateRect (USER.190)
855 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
860 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
861 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
864 rect->right = r.right;
865 rect->bottom = r.bottom;
870 /**************************************************************************
871 * ChildWindowFromPoint (USER.191)
873 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
879 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
883 /***********************************************************************
884 * GetWindowTask (USER.224)
886 HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
888 DWORD tid = GetWindowThreadProcessId( HWND_32(hwnd), NULL );
890 return HTASK_16(tid);
893 /**********************************************************************
894 * EnumTaskWindows (USER.225)
896 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
898 struct wnd_enum_info info;
899 DWORD tid = HTASK_32( hTask );
901 if (!tid) return FALSE;
904 return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
908 /**************************************************************************
909 * GetTopWindow (USER.229)
911 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
913 return HWND_16( GetTopWindow( WIN_Handle32(hwnd) ));
917 /**************************************************************************
918 * GetNextWindow (USER.230)
920 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
922 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
923 return GetWindow16( hwnd, flag );
927 /**************************************************************************
928 * SetWindowPos (USER.232)
930 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
931 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
933 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
934 x, y, cx, cy, flags );
938 /**************************************************************************
939 * SetParent (USER.233)
941 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
943 return HWND_16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
947 /**************************************************************************
948 * GetCapture (USER.236)
950 HWND16 WINAPI GetCapture16(void)
952 return HWND_16( GetCapture() );
956 /**************************************************************************
957 * GetUpdateRgn (USER.237)
959 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
961 return GetUpdateRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), erase );
965 /**************************************************************************
966 * ExcludeUpdateRgn (USER.238)
968 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
970 return ExcludeUpdateRgn( HDC_32(hdc), WIN_Handle32(hwnd) );
974 /**************************************************************************
975 * GetOpenClipboardWindow (USER.248)
977 HWND16 WINAPI GetOpenClipboardWindow16(void)
979 return HWND_16( GetOpenClipboardWindow() );
983 /**************************************************************************
984 * BeginDeferWindowPos (USER.259)
986 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
988 return HDWP_16(BeginDeferWindowPos( count ));
992 /**************************************************************************
993 * DeferWindowPos (USER.260)
995 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
996 INT16 x, INT16 y, INT16 cx, INT16 cy,
999 return HDWP_16(DeferWindowPos( HDWP_32(hdwp), WIN_Handle32(hwnd),
1000 full_insert_after_hwnd(hwndAfter), x, y, cx, cy, flags ));
1004 /**************************************************************************
1005 * EndDeferWindowPos (USER.261)
1007 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1009 return EndDeferWindowPos(HDWP_32(hdwp));
1013 /**************************************************************************
1014 * GetWindow (USER.262)
1016 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1018 return HWND_16( GetWindow( WIN_Handle32(hwnd), rel ) );
1022 /**************************************************************************
1023 * ShowOwnedPopups (USER.265)
1025 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1027 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1031 /**************************************************************************
1032 * ShowScrollBar (USER.267)
1034 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1036 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1040 /**************************************************************************
1041 * IsZoomed (USER.272)
1043 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1045 return IsZoomed( WIN_Handle32(hwnd) );
1049 /**************************************************************************
1050 * GetDlgCtrlID (USER.277)
1052 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1054 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1058 /**************************************************************************
1059 * GetDesktopHwnd (USER.278)
1061 * Exactly the same thing as GetDesktopWindow(), but not documented.
1062 * Don't ask me why...
1064 HWND16 WINAPI GetDesktopHwnd16(void)
1066 return GetDesktopWindow16();
1070 /**************************************************************************
1071 * SetSystemMenu (USER.280)
1073 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1075 return SetSystemMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
1079 /**************************************************************************
1080 * GetDesktopWindow (USER.286)
1082 HWND16 WINAPI GetDesktopWindow16(void)
1084 return HWND_16( GetDesktopWindow() );
1088 /**************************************************************************
1089 * GetLastActivePopup (USER.287)
1091 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1093 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1097 /**************************************************************************
1098 * RedrawWindow (USER.290)
1100 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1101 HRGN16 hrgnUpdate, UINT16 flags )
1106 r.left = rectUpdate->left;
1107 r.top = rectUpdate->top;
1108 r.right = rectUpdate->right;
1109 r.bottom = rectUpdate->bottom;
1110 return RedrawWindow(WIN_Handle32(hwnd), &r, HRGN_32(hrgnUpdate), flags);
1112 return RedrawWindow(WIN_Handle32(hwnd), NULL, HRGN_32(hrgnUpdate), flags);
1116 /**************************************************************************
1117 * LockWindowUpdate (USER.294)
1119 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1121 return LockWindowUpdate( WIN_Handle32(hwnd) );
1125 /**************************************************************************
1126 * ScrollWindowEx (USER.319)
1128 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1129 const RECT16 *rect, const RECT16 *clipRect,
1130 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1133 RECT rect32, clipRect32, rcUpdate32;
1138 rect32.left = rect->left;
1139 rect32.top = rect->top;
1140 rect32.right = rect->right;
1141 rect32.bottom = rect->bottom;
1145 clipRect32.left = clipRect->left;
1146 clipRect32.top = clipRect->top;
1147 clipRect32.right = clipRect->right;
1148 clipRect32.bottom = clipRect->bottom;
1150 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1151 clipRect ? &clipRect32 : NULL, HRGN_32(hrgnUpdate),
1152 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1155 rcUpdate->left = rcUpdate32.left;
1156 rcUpdate->top = rcUpdate32.top;
1157 rcUpdate->right = rcUpdate32.right;
1158 rcUpdate->bottom = rcUpdate32.bottom;
1164 /**************************************************************************
1165 * FillWindow (USER.324)
1167 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1171 GetClientRect( WIN_Handle32(hwnd), &rect );
1172 DPtoLP( HDC_32(hdc), (LPPOINT)&rect, 2 );
1173 rc16.left = rect.left;
1174 rc16.top = rect.top;
1175 rc16.right = rect.right;
1176 rc16.bottom = rect.bottom;
1177 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1181 /**************************************************************************
1182 * PaintRect (USER.325)
1184 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1185 HBRUSH16 hbrush, const RECT16 *rect)
1187 if (hbrush <= CTLCOLOR_STATIC)
1189 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1191 if (!parent) return;
1192 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1193 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1194 (WPARAM)hdc, (LPARAM)hwnd32 );
1196 if (hbrush) FillRect16( hdc, rect, hbrush );
1200 /**************************************************************************
1201 * GetControlBrush (USER.326)
1203 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1206 HWND hwnd32 = WIN_Handle32(hwnd);
1207 HWND parent = GetParent( hwnd32 );
1209 if (!parent) parent = hwnd32;
1210 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1211 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1212 (WPARAM)hdc, (LPARAM)hwnd32 );
1217 /**************************************************************************
1218 * GetDCEx (USER.359)
1220 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1222 return HDC_16(GetDCEx(WIN_Handle32(hwnd), HRGN_32(hrgnClip), flags));
1226 /**************************************************************************
1227 * GetWindowPlacement (USER.370)
1229 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1231 WINDOWPLACEMENT wpl;
1233 wpl.length = sizeof(wpl);
1234 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1235 wp16->length = sizeof(*wp16);
1236 wp16->flags = wpl.flags;
1237 wp16->showCmd = wpl.showCmd;
1238 wp16->ptMinPosition.x = wpl.ptMinPosition.x;
1239 wp16->ptMinPosition.y = wpl.ptMinPosition.y;
1240 wp16->ptMaxPosition.x = wpl.ptMaxPosition.x;
1241 wp16->ptMaxPosition.y = wpl.ptMaxPosition.y;
1242 wp16->rcNormalPosition.left = wpl.rcNormalPosition.left;
1243 wp16->rcNormalPosition.top = wpl.rcNormalPosition.top;
1244 wp16->rcNormalPosition.right = wpl.rcNormalPosition.right;
1245 wp16->rcNormalPosition.bottom = wpl.rcNormalPosition.bottom;
1250 /**************************************************************************
1251 * SetWindowPlacement (USER.371)
1253 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1255 WINDOWPLACEMENT wpl;
1257 if (!wp16) return FALSE;
1258 wpl.length = sizeof(wpl);
1259 wpl.flags = wp16->flags;
1260 wpl.showCmd = wp16->showCmd;
1261 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1262 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1263 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1264 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1265 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1266 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1267 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1268 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1269 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1273 /**************************************************************************
1274 * ChildWindowFromPointEx (USER.399)
1276 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1282 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1286 /**************************************************************************
1287 * GetPriorityClipboardFormat (USER.402)
1289 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1293 for (i = 0; i < count; i++)
1294 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1299 /**************************************************************************
1300 * TrackPopupMenu (USER.416)
1302 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1303 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1308 r.left = lpRect->left;
1309 r.top = lpRect->top;
1310 r.right = lpRect->right;
1311 r.bottom = lpRect->bottom;
1313 return TrackPopupMenu( HMENU_32(hMenu), wFlags, x, y, nReserved,
1314 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1318 /**************************************************************************
1319 * FindWindowEx (USER.427)
1321 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1323 return HWND_16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1324 className, title ));
1328 /***********************************************************************
1329 * DefFrameProc (USER.445)
1331 LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient,
1332 UINT16 message, WPARAM16 wParam, LPARAM lParam )
1337 lParam = (LPARAM)MapSL(lParam);
1343 return DefFrameProcA( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1344 message, wParam, lParam );
1348 MDINEXTMENU next_menu;
1349 DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1350 message, wParam, (LPARAM)&next_menu );
1351 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1354 return DefWindowProc16(hwnd, message, wParam, lParam);
1359 /***********************************************************************
1360 * DefMDIChildProc (USER.447)
1362 LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
1363 WPARAM16 wParam, LPARAM lParam )
1368 return DefMDIChildProcA( WIN_Handle32(hwnd), message, wParam, (LPARAM)MapSL(lParam) );
1373 case WM_CHILDACTIVATE:
1378 return DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, lParam );
1380 case WM_GETMINMAXINFO:
1382 MINMAXINFO16 *mmi16 = (MINMAXINFO16 *)MapSL(lParam);
1385 mmi.ptReserved.x = mmi16->ptReserved.x;
1386 mmi.ptReserved.y = mmi16->ptReserved.y;
1387 mmi.ptMaxSize.x = mmi16->ptMaxSize.x;
1388 mmi.ptMaxSize.y = mmi16->ptMaxSize.y;
1389 mmi.ptMaxPosition.x = mmi16->ptMaxPosition.x;
1390 mmi.ptMaxPosition.y = mmi16->ptMaxPosition.y;
1391 mmi.ptMinTrackSize.x = mmi16->ptMinTrackSize.x;
1392 mmi.ptMinTrackSize.y = mmi16->ptMinTrackSize.y;
1393 mmi.ptMaxTrackSize.x = mmi16->ptMaxTrackSize.x;
1394 mmi.ptMaxTrackSize.y = mmi16->ptMaxTrackSize.y;
1396 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&mmi );
1398 mmi16->ptReserved.x = mmi.ptReserved.x;
1399 mmi16->ptReserved.y = mmi.ptReserved.y;
1400 mmi16->ptMaxSize.x = mmi.ptMaxSize.x;
1401 mmi16->ptMaxSize.y = mmi.ptMaxSize.y;
1402 mmi16->ptMaxPosition.x = mmi.ptMaxPosition.x;
1403 mmi16->ptMaxPosition.y = mmi.ptMaxPosition.y;
1404 mmi16->ptMinTrackSize.x = mmi.ptMinTrackSize.x;
1405 mmi16->ptMinTrackSize.y = mmi.ptMinTrackSize.y;
1406 mmi16->ptMaxTrackSize.x = mmi.ptMaxTrackSize.x;
1407 mmi16->ptMaxTrackSize.y = mmi.ptMaxTrackSize.y;
1412 MDINEXTMENU next_menu;
1413 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
1414 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1417 return DefWindowProc16(hwnd, message, wParam, lParam);
1422 /**************************************************************************
1423 * DrawAnimatedRects (USER.448)
1425 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1426 const RECT16* lprcFrom, const RECT16* lprcTo )
1428 RECT rcFrom32, rcTo32;
1429 rcFrom32.left = lprcFrom->left;
1430 rcFrom32.top = lprcFrom->top;
1431 rcFrom32.right = lprcFrom->right;
1432 rcFrom32.bottom = lprcFrom->bottom;
1433 rcTo32.left = lprcTo->left;
1434 rcTo32.top = lprcTo->top;
1435 rcTo32.right = lprcTo->right;
1436 rcTo32.bottom = lprcTo->bottom;
1437 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1441 /***********************************************************************
1442 * GetInternalWindowPos (USER.460)
1444 UINT16 WINAPI GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd, LPPOINT16 ptIcon )
1446 WINDOWPLACEMENT16 wndpl;
1448 if (!GetWindowPlacement16( hwnd, &wndpl )) return 0;
1449 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1450 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1451 return wndpl.showCmd;
1455 /**************************************************************************
1456 * SetInternalWindowPos (USER.461)
1458 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1465 rc32.left = rect->left;
1466 rc32.top = rect->top;
1467 rc32.right = rect->right;
1468 rc32.bottom = rect->bottom;
1475 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1476 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1480 /**************************************************************************
1481 * CalcChildScroll (USER.462)
1483 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1485 CalcChildScroll( WIN_Handle32(hwnd), scroll );
1489 /**************************************************************************
1490 * ScrollChildren (USER.463)
1492 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1494 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1498 /**************************************************************************
1499 * DragDetect (USER.465)
1501 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1507 return DragDetect( WIN_Handle32(hwnd), pt32 );
1511 /**************************************************************************
1512 * SetScrollInfo (USER.475)
1514 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1516 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1520 /**************************************************************************
1521 * GetScrollInfo (USER.476)
1523 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1525 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1529 /**************************************************************************
1530 * EnableScrollBar (USER.482)
1532 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1534 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1538 /**************************************************************************
1539 * GetShellWindow (USER.600)
1541 HWND16 WINAPI GetShellWindow16(void)
1543 return HWND_16( GetShellWindow() );
1547 /**************************************************************************
1548 * GetForegroundWindow (USER.608)
1550 HWND16 WINAPI GetForegroundWindow16(void)
1552 return HWND_16( GetForegroundWindow() );
1556 /**************************************************************************
1557 * SetForegroundWindow (USER.609)
1559 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1561 return SetForegroundWindow( WIN_Handle32(hwnd) );
1565 /**************************************************************************
1566 * DrawCaptionTemp (USER.657)
1568 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1569 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1575 rect32.left = rect->left;
1576 rect32.top = rect->top;
1577 rect32.right = rect->right;
1578 rect32.bottom = rect->bottom;
1580 return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc),
1581 rect ? &rect32 : NULL, HFONT_32(hFont),
1582 HICON_32(hIcon), str, uFlags & 0x1f );
1586 /**************************************************************************
1587 * DrawCaption (USER.660)
1589 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1595 rect32.left = rect->left;
1596 rect32.top = rect->top;
1597 rect32.right = rect->right;
1598 rect32.bottom = rect->bottom;
1600 return DrawCaption(WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, flags);
1604 /**************************************************************************
1605 * GetMenuItemRect (USER.665)
1607 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1612 if (!rect) return FALSE;
1613 res = GetMenuItemRect( WIN_Handle32(hwnd), HMENU_32(hMenu), uItem, &r32 );
1614 rect->left = r32.left;
1615 rect->top = r32.top;
1616 rect->right = r32.right;
1617 rect->bottom = r32.bottom;
1622 /**************************************************************************
1623 * SetWindowRgn (USER.668)
1625 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1627 return SetWindowRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), redraw );
1631 /**************************************************************************
1632 * MessageBoxIndirect (USER.827)
1634 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1636 MSGBOXPARAMSA msgbox32;
1638 msgbox32.cbSize = msgbox->cbSize;
1639 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1640 msgbox32.hInstance = HINSTANCE_32(msgbox->hInstance);
1641 msgbox32.lpszText = MapSL(msgbox->lpszText);
1642 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1643 msgbox32.dwStyle = msgbox->dwStyle;
1644 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1645 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1646 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1647 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1648 return MessageBoxIndirectA( &msgbox32 );