Use IsWindowVisible instead of GetWindowLong(GWL_STYLE) & WS_VISIBLE
[wine.git] / dlls / user / wnd16.c
blob170f67b74e4a4aa0dd3f0c676678f8afac461ba5
1 /*
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"
22 #include "wownt32.h"
23 #include "user_private.h"
24 #include "win.h"
25 #include "winproc.h"
26 #include "stackframe.h"
28 /* handle <--> handle16 conversions */
29 #define HANDLE_16(h32) (LOWORD(h32))
30 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
32 static HWND16 hwndSysModal;
34 struct wnd_enum_info
36 WNDENUMPROC16 proc;
37 LPARAM param;
40 /* callback for 16-bit window enumeration functions */
41 static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param )
43 const struct wnd_enum_info *info = (struct wnd_enum_info *)param;
44 WORD args[3];
45 DWORD ret;
47 args[2] = HWND_16(hwnd);
48 args[1] = HIWORD(info->param);
49 args[0] = LOWORD(info->param);
50 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
51 return LOWORD(ret);
54 /* convert insert after window handle to 32-bit */
55 inline static HWND full_insert_after_hwnd( HWND16 hwnd )
57 HWND ret = WIN_Handle32( hwnd );
58 if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
59 return ret;
62 /**************************************************************************
63 * MessageBox (USER.1)
65 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
67 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
71 /***********************************************************************
72 * SetTimer (USER.10)
74 UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
76 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc( (WNDPROC)proc, WIN_PROC_16 );
77 return SetTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
81 /***********************************************************************
82 * SetSystemTimer (USER.11)
84 UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
86 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc( (WNDPROC)proc, WIN_PROC_16 );
87 return SetSystemTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
91 /**************************************************************************
92 * KillTimer (USER.12)
94 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
96 return KillTimer( WIN_Handle32(hwnd), id );
100 /**************************************************************************
101 * SetCapture (USER.18)
103 HWND16 WINAPI SetCapture16( HWND16 hwnd )
105 return HWND_16( SetCapture( WIN_Handle32(hwnd) ));
109 /**************************************************************************
110 * ReleaseCapture (USER.19)
112 BOOL16 WINAPI ReleaseCapture16(void)
114 return ReleaseCapture();
118 /**************************************************************************
119 * SetFocus (USER.22)
121 HWND16 WINAPI SetFocus16( HWND16 hwnd )
123 return HWND_16( SetFocus( WIN_Handle32(hwnd) ));
127 /**************************************************************************
128 * GetFocus (USER.23)
130 HWND16 WINAPI GetFocus16(void)
132 return HWND_16( GetFocus() );
136 /**************************************************************************
137 * RemoveProp (USER.24)
139 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
141 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd), str ));
145 /**************************************************************************
146 * GetProp (USER.25)
148 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
150 return HANDLE_16(GetPropA( WIN_Handle32(hwnd), str ));
154 /**************************************************************************
155 * SetProp (USER.26)
157 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
159 return SetPropA( WIN_Handle32(hwnd), str, HANDLE_32(handle) );
163 /**************************************************************************
164 * ClientToScreen (USER.28)
166 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
168 MapWindowPoints16( hwnd, 0, lppnt, 1 );
172 /**************************************************************************
173 * ScreenToClient (USER.29)
175 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
177 MapWindowPoints16( 0, hwnd, lppnt, 1 );
181 /**************************************************************************
182 * WindowFromPoint (USER.30)
184 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
186 POINT pt32;
188 pt32.x = pt.x;
189 pt32.y = pt.y;
190 return HWND_16( WindowFromPoint( pt32 ) );
194 /**************************************************************************
195 * IsIconic (USER.31)
197 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
199 return IsIconic( WIN_Handle32(hwnd) );
203 /**************************************************************************
204 * GetWindowRect (USER.32)
206 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
208 RECT rect32;
210 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
211 rect->left = rect32.left;
212 rect->top = rect32.top;
213 rect->right = rect32.right;
214 rect->bottom = rect32.bottom;
218 /**************************************************************************
219 * GetClientRect (USER.33)
221 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
223 RECT rect32;
225 GetClientRect( WIN_Handle32(hwnd), &rect32 );
226 rect->left = rect32.left;
227 rect->top = rect32.top;
228 rect->right = rect32.right;
229 rect->bottom = rect32.bottom;
233 /**************************************************************************
234 * EnableWindow (USER.34)
236 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
238 return EnableWindow( WIN_Handle32(hwnd), enable );
242 /**************************************************************************
243 * IsWindowEnabled (USER.35)
245 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
247 return IsWindowEnabled( WIN_Handle32(hwnd) );
251 /**************************************************************************
252 * GetWindowText (USER.36)
254 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
256 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
260 /**************************************************************************
261 * SetWindowText (USER.37)
263 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
265 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
269 /**************************************************************************
270 * GetWindowTextLength (USER.38)
272 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
274 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
278 /***********************************************************************
279 * BeginPaint (USER.39)
281 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
283 PAINTSTRUCT ps;
285 BeginPaint( WIN_Handle32(hwnd), &ps );
286 lps->hdc = HDC_16(ps.hdc);
287 lps->fErase = ps.fErase;
288 lps->rcPaint.top = ps.rcPaint.top;
289 lps->rcPaint.left = ps.rcPaint.left;
290 lps->rcPaint.right = ps.rcPaint.right;
291 lps->rcPaint.bottom = ps.rcPaint.bottom;
292 lps->fRestore = ps.fRestore;
293 lps->fIncUpdate = ps.fIncUpdate;
294 return lps->hdc;
298 /***********************************************************************
299 * EndPaint (USER.40)
301 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
303 PAINTSTRUCT ps;
305 ps.hdc = HDC_32(lps->hdc);
306 return EndPaint( WIN_Handle32(hwnd), &ps );
310 /**************************************************************************
311 * ShowWindow (USER.42)
313 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
315 return ShowWindow( WIN_Handle32(hwnd), cmd );
319 /**************************************************************************
320 * CloseWindow (USER.43)
322 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
324 return CloseWindow( WIN_Handle32(hwnd) );
328 /**************************************************************************
329 * OpenIcon (USER.44)
331 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
333 return OpenIcon( WIN_Handle32(hwnd) );
337 /**************************************************************************
338 * BringWindowToTop (USER.45)
340 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
342 return BringWindowToTop( WIN_Handle32(hwnd) );
346 /**************************************************************************
347 * GetParent (USER.46)
349 HWND16 WINAPI GetParent16( HWND16 hwnd )
351 return HWND_16( GetParent( WIN_Handle32(hwnd) ));
355 /**************************************************************************
356 * IsWindow (USER.47)
358 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
360 CURRENT_STACK16->es = USER_HeapSel;
361 /* don't use WIN_Handle32 here, we don't care about the full handle */
362 return IsWindow( HWND_32(hwnd) );
366 /**************************************************************************
367 * IsChild (USER.48)
369 BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
371 return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
375 /**************************************************************************
376 * IsWindowVisible (USER.49)
378 BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
380 return IsWindowVisible( WIN_Handle32(hwnd) );
384 /**************************************************************************
385 * FindWindow (USER.50)
387 HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
389 return HWND_16( FindWindowA( className, title ));
393 /**************************************************************************
394 * DestroyWindow (USER.53)
396 BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
398 return DestroyWindow( WIN_Handle32(hwnd) );
402 /*******************************************************************
403 * EnumWindows (USER.54)
405 BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
407 struct wnd_enum_info info;
409 info.proc = func;
410 info.param = lParam;
411 return EnumWindows( wnd_enum_callback, (LPARAM)&info );
415 /**********************************************************************
416 * EnumChildWindows (USER.55)
418 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
420 struct wnd_enum_info info;
422 info.proc = func;
423 info.param = lParam;
424 return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info );
428 /**************************************************************************
429 * MoveWindow (USER.56)
431 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
433 return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
437 /***********************************************************************
438 * RegisterClass (USER.57)
440 ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
442 WNDCLASSEX16 wcex;
444 wcex.cbSize = sizeof(wcex);
445 wcex.style = wc->style;
446 wcex.lpfnWndProc = wc->lpfnWndProc;
447 wcex.cbClsExtra = wc->cbClsExtra;
448 wcex.cbWndExtra = wc->cbWndExtra;
449 wcex.hInstance = wc->hInstance;
450 wcex.hIcon = wc->hIcon;
451 wcex.hCursor = wc->hCursor;
452 wcex.hbrBackground = wc->hbrBackground;
453 wcex.lpszMenuName = wc->lpszMenuName;
454 wcex.lpszClassName = wc->lpszClassName;
455 wcex.hIconSm = 0;
456 return RegisterClassEx16( &wcex );
460 /**************************************************************************
461 * GetClassName (USER.58)
463 INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
465 return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
469 /**************************************************************************
470 * SetActiveWindow (USER.59)
472 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
474 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd) ));
478 /**************************************************************************
479 * GetActiveWindow (USER.60)
481 HWND16 WINAPI GetActiveWindow16(void)
483 return HWND_16( GetActiveWindow() );
487 /**************************************************************************
488 * ScrollWindow (USER.61)
490 void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
491 const RECT16 *clipRect )
493 RECT rect32, clipRect32;
495 if (rect)
497 rect32.left = rect->left;
498 rect32.top = rect->top;
499 rect32.right = rect->right;
500 rect32.bottom = rect->bottom;
502 if (clipRect)
504 clipRect32.left = clipRect->left;
505 clipRect32.top = clipRect->top;
506 clipRect32.right = clipRect->right;
507 clipRect32.bottom = clipRect->bottom;
509 ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
510 clipRect ? &clipRect32 : NULL );
514 /**************************************************************************
515 * SetScrollPos (USER.62)
517 INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
519 return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
523 /**************************************************************************
524 * GetScrollPos (USER.63)
526 INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
528 return GetScrollPos( WIN_Handle32(hwnd), nBar );
532 /**************************************************************************
533 * SetScrollRange (USER.64)
535 void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
537 /* Invalid range -> range is set to (0,0) */
538 if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
539 SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
543 /**************************************************************************
544 * GetScrollRange (USER.65)
546 BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
548 INT min, max;
549 BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
550 if (lpMin) *lpMin = min;
551 if (lpMax) *lpMax = max;
552 return ret;
556 /**************************************************************************
557 * GetDC (USER.66)
559 HDC16 WINAPI GetDC16( HWND16 hwnd )
561 return HDC_16(GetDC( WIN_Handle32(hwnd) ));
565 /**************************************************************************
566 * GetWindowDC (USER.67)
568 HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
570 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
574 /**************************************************************************
575 * ReleaseDC (USER.68)
577 INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
579 return (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) );
583 /**************************************************************************
584 * FlashWindow (USER.105)
586 BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
588 return FlashWindow( WIN_Handle32(hwnd), bInvert );
592 /**************************************************************************
593 * WindowFromDC (USER.117)
595 HWND16 WINAPI WindowFromDC16( HDC16 hDC )
597 return HWND_16( WindowFromDC( HDC_32(hDC) ) );
601 /**************************************************************************
602 * UpdateWindow (USER.124)
604 void WINAPI UpdateWindow16( HWND16 hwnd )
606 RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
610 /**************************************************************************
611 * InvalidateRect (USER.125)
613 void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
615 RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
619 /**************************************************************************
620 * InvalidateRgn (USER.126)
622 void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
624 RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
628 /**************************************************************************
629 * ValidateRect (USER.127)
631 void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
633 RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
637 /**************************************************************************
638 * ValidateRgn (USER.128)
640 void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
642 RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
646 /**************************************************************************
647 * GetClassWord (USER.129)
649 WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
651 return GetClassWord( WIN_Handle32(hwnd), offset );
655 /**************************************************************************
656 * SetClassWord (USER.130)
658 WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
660 return SetClassWord( WIN_Handle32(hwnd), offset, newval );
664 /**************************************************************************
665 * GetWindowWord (USER.133)
667 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
669 return GetWindowWord( WIN_Handle32(hwnd), offset );
673 /**************************************************************************
674 * SetWindowWord (USER.134)
676 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
678 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
682 /**************************************************************************
683 * OpenClipboard (USER.137)
685 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
687 return OpenClipboard( WIN_Handle32(hwnd) );
691 /**************************************************************************
692 * GetClipboardOwner (USER.140)
694 HWND16 WINAPI GetClipboardOwner16(void)
696 return HWND_16( GetClipboardOwner() );
700 /**************************************************************************
701 * SetClipboardViewer (USER.147)
703 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
705 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd) ));
709 /**************************************************************************
710 * GetClipboardViewer (USER.148)
712 HWND16 WINAPI GetClipboardViewer16(void)
714 return HWND_16( GetClipboardViewer() );
718 /**************************************************************************
719 * ChangeClipboardChain (USER.149)
721 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
723 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
727 /**************************************************************************
728 * GetSystemMenu (USER.156)
730 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
732 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd), revert ));
736 /**************************************************************************
737 * GetMenu (USER.157)
739 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
741 return HMENU_16(GetMenu( WIN_Handle32(hwnd) ));
745 /**************************************************************************
746 * SetMenu (USER.158)
748 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
750 return SetMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
754 /**************************************************************************
755 * DrawMenuBar (USER.160)
757 void WINAPI DrawMenuBar16( HWND16 hwnd )
759 DrawMenuBar( WIN_Handle32(hwnd) );
763 /**************************************************************************
764 * HiliteMenuItem (USER.162)
766 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
768 return HiliteMenuItem( WIN_Handle32(hwnd), HMENU_32(hMenu), id, wHilite );
772 /**************************************************************************
773 * CreateCaret (USER.163)
775 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
777 CreateCaret( WIN_Handle32(hwnd), HBITMAP_32(bitmap), width, height );
781 /*****************************************************************
782 * DestroyCaret (USER.164)
784 void WINAPI DestroyCaret16(void)
786 DestroyCaret();
790 /*****************************************************************
791 * SetCaretPos (USER.165)
793 void WINAPI SetCaretPos16( INT16 x, INT16 y )
795 SetCaretPos( x, y );
799 /**************************************************************************
800 * HideCaret (USER.166)
802 void WINAPI HideCaret16( HWND16 hwnd )
804 HideCaret( WIN_Handle32(hwnd) );
808 /**************************************************************************
809 * ShowCaret (USER.167)
811 void WINAPI ShowCaret16( HWND16 hwnd )
813 ShowCaret( WIN_Handle32(hwnd) );
817 /*****************************************************************
818 * SetCaretBlinkTime (USER.168)
820 void WINAPI SetCaretBlinkTime16( UINT16 msecs )
822 SetCaretBlinkTime( msecs );
826 /*****************************************************************
827 * GetCaretBlinkTime (USER.169)
829 UINT16 WINAPI GetCaretBlinkTime16(void)
831 return GetCaretBlinkTime();
835 /**************************************************************************
836 * ArrangeIconicWindows (USER.170)
838 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
840 return ArrangeIconicWindows( WIN_Handle32(parent) );
844 /**************************************************************************
845 * SwitchToThisWindow (USER.172)
847 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
849 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
853 /**************************************************************************
854 * KillSystemTimer (USER.182)
856 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
858 return KillSystemTimer( WIN_Handle32(hwnd), id );
862 /*****************************************************************
863 * GetCaretPos (USER.183)
865 void WINAPI GetCaretPos16( LPPOINT16 pt16 )
867 POINT pt;
868 if (GetCaretPos( &pt ))
870 pt16->x = pt.x;
871 pt16->y = pt.y;
876 /**************************************************************************
877 * SetSysModalWindow (USER.188)
879 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
881 HWND16 old = hwndSysModal;
882 hwndSysModal = hwnd;
883 return old;
887 /**************************************************************************
888 * GetSysModalWindow (USER.189)
890 HWND16 WINAPI GetSysModalWindow16(void)
892 return hwndSysModal;
896 /**************************************************************************
897 * GetUpdateRect (USER.190)
899 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
901 RECT r;
902 BOOL16 ret;
904 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
905 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
906 rect->left = r.left;
907 rect->top = r.top;
908 rect->right = r.right;
909 rect->bottom = r.bottom;
910 return ret;
914 /**************************************************************************
915 * ChildWindowFromPoint (USER.191)
917 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
919 POINT pt32;
921 pt32.x = pt.x;
922 pt32.y = pt.y;
923 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
927 /***********************************************************************
928 * GetWindowTask (USER.224)
930 HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
932 DWORD tid = GetWindowThreadProcessId( HWND_32(hwnd), NULL );
933 if (!tid) return 0;
934 return HTASK_16(tid);
937 /**********************************************************************
938 * EnumTaskWindows (USER.225)
940 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
942 struct wnd_enum_info info;
943 DWORD tid = HTASK_32( hTask );
945 if (!tid) return FALSE;
946 info.proc = func;
947 info.param = lParam;
948 return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
952 /**************************************************************************
953 * GetTopWindow (USER.229)
955 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
957 return HWND_16( GetTopWindow( WIN_Handle32(hwnd) ));
961 /**************************************************************************
962 * GetNextWindow (USER.230)
964 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
966 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
967 return GetWindow16( hwnd, flag );
971 /**************************************************************************
972 * SetWindowPos (USER.232)
974 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
975 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
977 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
978 x, y, cx, cy, flags );
982 /**************************************************************************
983 * SetParent (USER.233)
985 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
987 return HWND_16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
991 /**************************************************************************
992 * GetCapture (USER.236)
994 HWND16 WINAPI GetCapture16(void)
996 return HWND_16( GetCapture() );
1000 /**************************************************************************
1001 * GetUpdateRgn (USER.237)
1003 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
1005 return GetUpdateRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), erase );
1009 /**************************************************************************
1010 * ExcludeUpdateRgn (USER.238)
1012 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
1014 return ExcludeUpdateRgn( HDC_32(hdc), WIN_Handle32(hwnd) );
1018 /**************************************************************************
1019 * GetOpenClipboardWindow (USER.248)
1021 HWND16 WINAPI GetOpenClipboardWindow16(void)
1023 return HWND_16( GetOpenClipboardWindow() );
1027 /**************************************************************************
1028 * BeginDeferWindowPos (USER.259)
1030 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1032 return HDWP_16(BeginDeferWindowPos( count ));
1036 /**************************************************************************
1037 * DeferWindowPos (USER.260)
1039 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1040 INT16 x, INT16 y, INT16 cx, INT16 cy,
1041 UINT16 flags )
1043 return HDWP_16(DeferWindowPos( HDWP_32(hdwp), WIN_Handle32(hwnd),
1044 full_insert_after_hwnd(hwndAfter), x, y, cx, cy, flags ));
1048 /**************************************************************************
1049 * EndDeferWindowPos (USER.261)
1051 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1053 return EndDeferWindowPos(HDWP_32(hdwp));
1057 /**************************************************************************
1058 * GetWindow (USER.262)
1060 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1062 return HWND_16( GetWindow( WIN_Handle32(hwnd), rel ) );
1066 /**************************************************************************
1067 * ShowOwnedPopups (USER.265)
1069 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1071 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1075 /**************************************************************************
1076 * ShowScrollBar (USER.267)
1078 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1080 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1084 /**************************************************************************
1085 * IsZoomed (USER.272)
1087 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1089 return IsZoomed( WIN_Handle32(hwnd) );
1093 /**************************************************************************
1094 * GetDlgCtrlID (USER.277)
1096 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1098 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1102 /**************************************************************************
1103 * GetDesktopHwnd (USER.278)
1105 * Exactly the same thing as GetDesktopWindow(), but not documented.
1106 * Don't ask me why...
1108 HWND16 WINAPI GetDesktopHwnd16(void)
1110 return GetDesktopWindow16();
1114 /**************************************************************************
1115 * SetSystemMenu (USER.280)
1117 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1119 return SetSystemMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
1123 /**************************************************************************
1124 * GetDesktopWindow (USER.286)
1126 HWND16 WINAPI GetDesktopWindow16(void)
1128 return HWND_16( GetDesktopWindow() );
1132 /**************************************************************************
1133 * GetLastActivePopup (USER.287)
1135 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1137 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1141 /**************************************************************************
1142 * RedrawWindow (USER.290)
1144 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1145 HRGN16 hrgnUpdate, UINT16 flags )
1147 if (rectUpdate)
1149 RECT r;
1150 r.left = rectUpdate->left;
1151 r.top = rectUpdate->top;
1152 r.right = rectUpdate->right;
1153 r.bottom = rectUpdate->bottom;
1154 return RedrawWindow(WIN_Handle32(hwnd), &r, HRGN_32(hrgnUpdate), flags);
1156 return RedrawWindow(WIN_Handle32(hwnd), NULL, HRGN_32(hrgnUpdate), flags);
1160 /**************************************************************************
1161 * LockWindowUpdate (USER.294)
1163 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1165 return LockWindowUpdate( WIN_Handle32(hwnd) );
1169 /**************************************************************************
1170 * ScrollWindowEx (USER.319)
1172 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1173 const RECT16 *rect, const RECT16 *clipRect,
1174 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1175 UINT16 flags )
1177 RECT rect32, clipRect32, rcUpdate32;
1178 BOOL16 ret;
1180 if (rect)
1182 rect32.left = rect->left;
1183 rect32.top = rect->top;
1184 rect32.right = rect->right;
1185 rect32.bottom = rect->bottom;
1187 if (clipRect)
1189 clipRect32.left = clipRect->left;
1190 clipRect32.top = clipRect->top;
1191 clipRect32.right = clipRect->right;
1192 clipRect32.bottom = clipRect->bottom;
1194 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1195 clipRect ? &clipRect32 : NULL, HRGN_32(hrgnUpdate),
1196 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1197 if (rcUpdate)
1199 rcUpdate->left = rcUpdate32.left;
1200 rcUpdate->top = rcUpdate32.top;
1201 rcUpdate->right = rcUpdate32.right;
1202 rcUpdate->bottom = rcUpdate32.bottom;
1204 return ret;
1208 /**************************************************************************
1209 * FillWindow (USER.324)
1211 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1213 RECT rect;
1214 RECT16 rc16;
1215 GetClientRect( WIN_Handle32(hwnd), &rect );
1216 DPtoLP( HDC_32(hdc), (LPPOINT)&rect, 2 );
1217 rc16.left = rect.left;
1218 rc16.top = rect.top;
1219 rc16.right = rect.right;
1220 rc16.bottom = rect.bottom;
1221 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1225 /**************************************************************************
1226 * PaintRect (USER.325)
1228 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1229 HBRUSH16 hbrush, const RECT16 *rect)
1231 if (hbrush <= CTLCOLOR_STATIC)
1233 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1235 if (!parent) return;
1236 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1237 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1238 (WPARAM)hdc, (LPARAM)hwnd32 );
1240 if (hbrush) FillRect16( hdc, rect, hbrush );
1244 /**************************************************************************
1245 * GetControlBrush (USER.326)
1247 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1249 HBRUSH16 ret;
1250 HWND hwnd32 = WIN_Handle32(hwnd);
1251 HWND parent = GetParent( hwnd32 );
1253 if (!parent) parent = hwnd32;
1254 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1255 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1256 (WPARAM)hdc, (LPARAM)hwnd32 );
1257 return ret;
1261 /**************************************************************************
1262 * GetDCEx (USER.359)
1264 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1266 return HDC_16(GetDCEx(WIN_Handle32(hwnd), HRGN_32(hrgnClip), flags));
1270 /**************************************************************************
1271 * GetWindowPlacement (USER.370)
1273 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1275 WINDOWPLACEMENT wpl;
1277 wpl.length = sizeof(wpl);
1278 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1279 wp16->length = sizeof(*wp16);
1280 wp16->flags = wpl.flags;
1281 wp16->showCmd = wpl.showCmd;
1282 wp16->ptMinPosition.x = wpl.ptMinPosition.x;
1283 wp16->ptMinPosition.y = wpl.ptMinPosition.y;
1284 wp16->ptMaxPosition.x = wpl.ptMaxPosition.x;
1285 wp16->ptMaxPosition.y = wpl.ptMaxPosition.y;
1286 wp16->rcNormalPosition.left = wpl.rcNormalPosition.left;
1287 wp16->rcNormalPosition.top = wpl.rcNormalPosition.top;
1288 wp16->rcNormalPosition.right = wpl.rcNormalPosition.right;
1289 wp16->rcNormalPosition.bottom = wpl.rcNormalPosition.bottom;
1290 return TRUE;
1294 /**************************************************************************
1295 * SetWindowPlacement (USER.371)
1297 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1299 WINDOWPLACEMENT wpl;
1301 if (!wp16) return FALSE;
1302 wpl.length = sizeof(wpl);
1303 wpl.flags = wp16->flags;
1304 wpl.showCmd = wp16->showCmd;
1305 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1306 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1307 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1308 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1309 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1310 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1311 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1312 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1313 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1317 /***********************************************************************
1318 * RegisterClassEx (USER.397)
1320 ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
1322 WNDCLASSEXA wc32;
1324 wc32.cbSize = sizeof(wc32);
1325 wc32.style = wc->style;
1326 wc32.lpfnWndProc = WINPROC_AllocProc( (WNDPROC)wc->lpfnWndProc, WIN_PROC_16 );
1327 wc32.cbClsExtra = wc->cbClsExtra;
1328 wc32.cbWndExtra = wc->cbWndExtra;
1329 wc32.hInstance = HINSTANCE_32(GetExePtr(wc->hInstance));
1330 if (!wc32.hInstance) wc32.hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
1331 wc32.hIcon = HICON_32(wc->hIcon);
1332 wc32.hCursor = HCURSOR_32(wc->hCursor);
1333 wc32.hbrBackground = HBRUSH_32(wc->hbrBackground);
1334 wc32.lpszMenuName = MapSL(wc->lpszMenuName);
1335 wc32.lpszClassName = MapSL(wc->lpszClassName);
1336 wc32.hIconSm = HICON_32(wc->hIconSm);
1337 return RegisterClassExA( &wc32 );
1341 /***********************************************************************
1342 * GetClassInfoEx (USER.398)
1344 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1345 * same in Win16 as in Win32. --AJ
1347 BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
1349 WNDCLASSEXA wc32;
1350 HINSTANCE hInstance;
1351 BOOL ret;
1353 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1354 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
1356 ret = GetClassInfoExA( hInstance, MapSL(name), &wc32 );
1358 if (ret)
1360 WNDPROC proc = WINPROC_AllocProc( wc32.lpfnWndProc, WIN_PROC_32A );
1361 wc->lpfnWndProc = WINPROC_GetProc( proc, WIN_PROC_16 );
1362 wc->style = wc32.style;
1363 wc->cbClsExtra = wc32.cbClsExtra;
1364 wc->cbWndExtra = wc32.cbWndExtra;
1365 wc->hInstance = (wc32.hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(wc32.hInstance);
1366 wc->hIcon = HICON_16(wc32.hIcon);
1367 wc->hIconSm = HICON_16(wc32.hIconSm);
1368 wc->hCursor = HCURSOR_16(wc32.hCursor);
1369 wc->hbrBackground = HBRUSH_16(wc32.hbrBackground);
1370 wc->lpszClassName = 0;
1371 wc->lpszMenuName = MapLS(wc32.lpszMenuName); /* FIXME: leak */
1373 return ret;
1377 /**************************************************************************
1378 * ChildWindowFromPointEx (USER.399)
1380 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1382 POINT pt32;
1384 pt32.x = pt.x;
1385 pt32.y = pt.y;
1386 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1390 /**************************************************************************
1391 * GetPriorityClipboardFormat (USER.402)
1393 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1395 int i;
1397 for (i = 0; i < count; i++)
1398 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1399 return -1;
1403 /***********************************************************************
1404 * UnregisterClass (USER.403)
1406 BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
1408 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
1409 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
1413 /***********************************************************************
1414 * GetClassInfo (USER.404)
1416 BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
1418 WNDCLASSEX16 wcex;
1419 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
1421 if (ret)
1423 wc->style = wcex.style;
1424 wc->lpfnWndProc = wcex.lpfnWndProc;
1425 wc->cbClsExtra = wcex.cbClsExtra;
1426 wc->cbWndExtra = wcex.cbWndExtra;
1427 wc->hInstance = wcex.hInstance;
1428 wc->hIcon = wcex.hIcon;
1429 wc->hCursor = wcex.hCursor;
1430 wc->hbrBackground = wcex.hbrBackground;
1431 wc->lpszMenuName = wcex.lpszMenuName;
1432 wc->lpszClassName = wcex.lpszClassName;
1434 return ret;
1438 /**************************************************************************
1439 * TrackPopupMenu (USER.416)
1441 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1442 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1444 RECT r;
1445 if (lpRect)
1447 r.left = lpRect->left;
1448 r.top = lpRect->top;
1449 r.right = lpRect->right;
1450 r.bottom = lpRect->bottom;
1452 return TrackPopupMenu( HMENU_32(hMenu), wFlags, x, y, nReserved,
1453 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1457 /**************************************************************************
1458 * FindWindowEx (USER.427)
1460 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1462 return HWND_16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1463 className, title ));
1467 /***********************************************************************
1468 * DefFrameProc (USER.445)
1470 LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient,
1471 UINT16 message, WPARAM16 wParam, LPARAM lParam )
1473 switch (message)
1475 case WM_SETTEXT:
1476 lParam = (LPARAM)MapSL(lParam);
1477 /* fall through */
1478 case WM_COMMAND:
1479 case WM_NCACTIVATE:
1480 case WM_SETFOCUS:
1481 case WM_SIZE:
1482 return DefFrameProcA( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1483 message, wParam, lParam );
1485 case WM_NEXTMENU:
1487 MDINEXTMENU next_menu;
1488 DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1489 message, wParam, (LPARAM)&next_menu );
1490 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1492 default:
1493 return DefWindowProc16(hwnd, message, wParam, lParam);
1498 /***********************************************************************
1499 * DefMDIChildProc (USER.447)
1501 LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
1502 WPARAM16 wParam, LPARAM lParam )
1504 switch (message)
1506 case WM_SETTEXT:
1507 return DefMDIChildProcA( WIN_Handle32(hwnd), message, wParam, (LPARAM)MapSL(lParam) );
1509 case WM_MENUCHAR:
1510 case WM_CLOSE:
1511 case WM_SETFOCUS:
1512 case WM_CHILDACTIVATE:
1513 case WM_SYSCOMMAND:
1514 case WM_SETVISIBLE:
1515 case WM_SIZE:
1516 case WM_SYSCHAR:
1517 return DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, lParam );
1519 case WM_GETMINMAXINFO:
1521 MINMAXINFO16 *mmi16 = (MINMAXINFO16 *)MapSL(lParam);
1522 MINMAXINFO mmi;
1524 mmi.ptReserved.x = mmi16->ptReserved.x;
1525 mmi.ptReserved.y = mmi16->ptReserved.y;
1526 mmi.ptMaxSize.x = mmi16->ptMaxSize.x;
1527 mmi.ptMaxSize.y = mmi16->ptMaxSize.y;
1528 mmi.ptMaxPosition.x = mmi16->ptMaxPosition.x;
1529 mmi.ptMaxPosition.y = mmi16->ptMaxPosition.y;
1530 mmi.ptMinTrackSize.x = mmi16->ptMinTrackSize.x;
1531 mmi.ptMinTrackSize.y = mmi16->ptMinTrackSize.y;
1532 mmi.ptMaxTrackSize.x = mmi16->ptMaxTrackSize.x;
1533 mmi.ptMaxTrackSize.y = mmi16->ptMaxTrackSize.y;
1535 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&mmi );
1537 mmi16->ptReserved.x = mmi.ptReserved.x;
1538 mmi16->ptReserved.y = mmi.ptReserved.y;
1539 mmi16->ptMaxSize.x = mmi.ptMaxSize.x;
1540 mmi16->ptMaxSize.y = mmi.ptMaxSize.y;
1541 mmi16->ptMaxPosition.x = mmi.ptMaxPosition.x;
1542 mmi16->ptMaxPosition.y = mmi.ptMaxPosition.y;
1543 mmi16->ptMinTrackSize.x = mmi.ptMinTrackSize.x;
1544 mmi16->ptMinTrackSize.y = mmi.ptMinTrackSize.y;
1545 mmi16->ptMaxTrackSize.x = mmi.ptMaxTrackSize.x;
1546 mmi16->ptMaxTrackSize.y = mmi.ptMaxTrackSize.y;
1547 return 0;
1549 case WM_NEXTMENU:
1551 MDINEXTMENU next_menu;
1552 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
1553 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1555 default:
1556 return DefWindowProc16(hwnd, message, wParam, lParam);
1561 /**************************************************************************
1562 * DrawAnimatedRects (USER.448)
1564 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1565 const RECT16* lprcFrom, const RECT16* lprcTo )
1567 RECT rcFrom32, rcTo32;
1568 rcFrom32.left = lprcFrom->left;
1569 rcFrom32.top = lprcFrom->top;
1570 rcFrom32.right = lprcFrom->right;
1571 rcFrom32.bottom = lprcFrom->bottom;
1572 rcTo32.left = lprcTo->left;
1573 rcTo32.top = lprcTo->top;
1574 rcTo32.right = lprcTo->right;
1575 rcTo32.bottom = lprcTo->bottom;
1576 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1580 /***********************************************************************
1581 * GetInternalWindowPos (USER.460)
1583 UINT16 WINAPI GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd, LPPOINT16 ptIcon )
1585 WINDOWPLACEMENT16 wndpl;
1587 if (!GetWindowPlacement16( hwnd, &wndpl )) return 0;
1588 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1589 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1590 return wndpl.showCmd;
1594 /**************************************************************************
1595 * SetInternalWindowPos (USER.461)
1597 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1599 RECT rc32;
1600 POINT pt32;
1602 if (rect)
1604 rc32.left = rect->left;
1605 rc32.top = rect->top;
1606 rc32.right = rect->right;
1607 rc32.bottom = rect->bottom;
1609 if (pt)
1611 pt32.x = pt->x;
1612 pt32.y = pt->y;
1614 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1615 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1619 /**************************************************************************
1620 * CalcChildScroll (USER.462)
1622 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1624 CalcChildScroll( WIN_Handle32(hwnd), scroll );
1628 /**************************************************************************
1629 * ScrollChildren (USER.463)
1631 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1633 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1637 /**************************************************************************
1638 * DragDetect (USER.465)
1640 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1642 POINT pt32;
1644 pt32.x = pt.x;
1645 pt32.y = pt.y;
1646 return DragDetect( WIN_Handle32(hwnd), pt32 );
1650 /**************************************************************************
1651 * SetScrollInfo (USER.475)
1653 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1655 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1659 /**************************************************************************
1660 * GetScrollInfo (USER.476)
1662 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1664 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1668 /**************************************************************************
1669 * EnableScrollBar (USER.482)
1671 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1673 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1677 /**************************************************************************
1678 * GetShellWindow (USER.600)
1680 HWND16 WINAPI GetShellWindow16(void)
1682 return HWND_16( GetShellWindow() );
1686 /**************************************************************************
1687 * GetForegroundWindow (USER.608)
1689 HWND16 WINAPI GetForegroundWindow16(void)
1691 return HWND_16( GetForegroundWindow() );
1695 /**************************************************************************
1696 * SetForegroundWindow (USER.609)
1698 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1700 return SetForegroundWindow( WIN_Handle32(hwnd) );
1704 /**************************************************************************
1705 * DrawCaptionTemp (USER.657)
1707 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1708 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1710 RECT rect32;
1712 if (rect)
1714 rect32.left = rect->left;
1715 rect32.top = rect->top;
1716 rect32.right = rect->right;
1717 rect32.bottom = rect->bottom;
1719 return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc),
1720 rect ? &rect32 : NULL, HFONT_32(hFont),
1721 HICON_32(hIcon), str, uFlags & 0x1f );
1725 /**************************************************************************
1726 * DrawCaption (USER.660)
1728 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1730 RECT rect32;
1732 if (rect)
1734 rect32.left = rect->left;
1735 rect32.top = rect->top;
1736 rect32.right = rect->right;
1737 rect32.bottom = rect->bottom;
1739 return DrawCaption(WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, flags);
1743 /**************************************************************************
1744 * GetMenuItemRect (USER.665)
1746 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1747 LPRECT16 rect)
1749 RECT r32;
1750 BOOL res;
1751 if (!rect) return FALSE;
1752 res = GetMenuItemRect( WIN_Handle32(hwnd), HMENU_32(hMenu), uItem, &r32 );
1753 rect->left = r32.left;
1754 rect->top = r32.top;
1755 rect->right = r32.right;
1756 rect->bottom = r32.bottom;
1757 return res;
1761 /**************************************************************************
1762 * SetWindowRgn (USER.668)
1764 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1766 return SetWindowRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), redraw );
1770 /**************************************************************************
1771 * MessageBoxIndirect (USER.827)
1773 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1775 MSGBOXPARAMSA msgbox32;
1777 msgbox32.cbSize = msgbox->cbSize;
1778 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1779 msgbox32.hInstance = HINSTANCE_32(msgbox->hInstance);
1780 msgbox32.lpszText = MapSL(msgbox->lpszText);
1781 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1782 msgbox32.dwStyle = msgbox->dwStyle;
1783 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1784 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1785 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1786 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1787 return MessageBoxIndirectA( &msgbox32 );