wined3d: Break the lighting state out of the vertex decl.
[wine.git] / dlls / user32 / wnd16.c
blobea68d6255ed92d0778cbb78fe874b0ddeffc8677
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/winuser16.h"
22 #include "wownt32.h"
23 #include "win.h"
24 #include "winproc.h"
25 #include "user_private.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;
33 struct wnd_enum_info
35 WNDENUMPROC16 proc;
36 LPARAM param;
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;
43 WORD args[3];
44 DWORD ret;
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 );
50 return LOWORD(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;
58 return ret;
61 /**************************************************************************
62 * MessageBox (USER.1)
64 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
66 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
70 /***********************************************************************
71 * SetTimer (USER.10)
73 UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
75 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
76 return SetTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
80 /***********************************************************************
81 * SetSystemTimer (USER.11)
83 UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
85 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
86 return SetSystemTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
90 /**************************************************************************
91 * KillTimer (USER.12)
93 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
95 return KillTimer( WIN_Handle32(hwnd), id );
99 /**************************************************************************
100 * SetCapture (USER.18)
102 HWND16 WINAPI SetCapture16( HWND16 hwnd )
104 return HWND_16( SetCapture( WIN_Handle32(hwnd) ));
108 /**************************************************************************
109 * ReleaseCapture (USER.19)
111 BOOL16 WINAPI ReleaseCapture16(void)
113 return ReleaseCapture();
117 /**************************************************************************
118 * SetFocus (USER.22)
120 HWND16 WINAPI SetFocus16( HWND16 hwnd )
122 return HWND_16( SetFocus( WIN_Handle32(hwnd) ));
126 /**************************************************************************
127 * GetFocus (USER.23)
129 HWND16 WINAPI GetFocus16(void)
131 return HWND_16( GetFocus() );
135 /**************************************************************************
136 * RemoveProp (USER.24)
138 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
140 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd), str ));
144 /**************************************************************************
145 * GetProp (USER.25)
147 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
149 return HANDLE_16(GetPropA( WIN_Handle32(hwnd), str ));
153 /**************************************************************************
154 * SetProp (USER.26)
156 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
158 return SetPropA( WIN_Handle32(hwnd), str, HANDLE_32(handle) );
162 /**************************************************************************
163 * ClientToScreen (USER.28)
165 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
167 MapWindowPoints16( hwnd, 0, lppnt, 1 );
171 /**************************************************************************
172 * ScreenToClient (USER.29)
174 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
176 MapWindowPoints16( 0, hwnd, lppnt, 1 );
180 /**************************************************************************
181 * WindowFromPoint (USER.30)
183 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
185 POINT pt32;
187 pt32.x = pt.x;
188 pt32.y = pt.y;
189 return HWND_16( WindowFromPoint( pt32 ) );
193 /**************************************************************************
194 * IsIconic (USER.31)
196 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
198 return IsIconic( WIN_Handle32(hwnd) );
202 /**************************************************************************
203 * GetWindowRect (USER.32)
205 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
207 RECT rect32;
209 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
210 rect->left = rect32.left;
211 rect->top = rect32.top;
212 rect->right = rect32.right;
213 rect->bottom = rect32.bottom;
217 /**************************************************************************
218 * GetClientRect (USER.33)
220 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
222 RECT rect32;
224 GetClientRect( WIN_Handle32(hwnd), &rect32 );
225 rect->left = rect32.left;
226 rect->top = rect32.top;
227 rect->right = rect32.right;
228 rect->bottom = rect32.bottom;
232 /**************************************************************************
233 * EnableWindow (USER.34)
235 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
237 return EnableWindow( WIN_Handle32(hwnd), enable );
241 /**************************************************************************
242 * IsWindowEnabled (USER.35)
244 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
246 return IsWindowEnabled( WIN_Handle32(hwnd) );
250 /**************************************************************************
251 * GetWindowText (USER.36)
253 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
255 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
259 /**************************************************************************
260 * SetWindowText (USER.37)
262 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
264 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
268 /**************************************************************************
269 * GetWindowTextLength (USER.38)
271 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
273 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
277 /***********************************************************************
278 * BeginPaint (USER.39)
280 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
282 PAINTSTRUCT ps;
284 BeginPaint( WIN_Handle32(hwnd), &ps );
285 lps->hdc = HDC_16(ps.hdc);
286 lps->fErase = ps.fErase;
287 lps->rcPaint.top = ps.rcPaint.top;
288 lps->rcPaint.left = ps.rcPaint.left;
289 lps->rcPaint.right = ps.rcPaint.right;
290 lps->rcPaint.bottom = ps.rcPaint.bottom;
291 lps->fRestore = ps.fRestore;
292 lps->fIncUpdate = ps.fIncUpdate;
293 return lps->hdc;
297 /***********************************************************************
298 * EndPaint (USER.40)
300 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
302 PAINTSTRUCT ps;
304 ps.hdc = HDC_32(lps->hdc);
305 return EndPaint( WIN_Handle32(hwnd), &ps );
309 /**************************************************************************
310 * ShowWindow (USER.42)
312 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
314 return ShowWindow( WIN_Handle32(hwnd), cmd );
318 /**************************************************************************
319 * CloseWindow (USER.43)
321 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
323 return CloseWindow( WIN_Handle32(hwnd) );
327 /**************************************************************************
328 * OpenIcon (USER.44)
330 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
332 return OpenIcon( WIN_Handle32(hwnd) );
336 /**************************************************************************
337 * BringWindowToTop (USER.45)
339 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
341 return BringWindowToTop( WIN_Handle32(hwnd) );
345 /**************************************************************************
346 * GetParent (USER.46)
348 HWND16 WINAPI GetParent16( HWND16 hwnd )
350 return HWND_16( GetParent( WIN_Handle32(hwnd) ));
354 /**************************************************************************
355 * IsWindow (USER.47)
357 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
359 STACK16FRAME *frame = MapSL( (SEGPTR)NtCurrentTeb()->WOW32Reserved );
360 frame->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 * GetClassLong (USER.131)
667 LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
669 LONG_PTR ret = GetClassLongA( WIN_Handle32(hwnd16), offset );
671 switch( offset )
673 case GCLP_WNDPROC:
674 return (LONG_PTR)WINPROC_GetProc16( (WNDPROC)ret, FALSE );
675 case GCLP_MENUNAME:
676 return MapLS( (void *)ret ); /* leak */
677 default:
678 return ret;
683 /***********************************************************************
684 * SetClassLong (USER.132)
686 LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
688 switch( offset )
690 case GCLP_WNDPROC:
692 WNDPROC new_proc = WINPROC_AllocProc16( (WNDPROC16)newval );
693 WNDPROC old_proc = (WNDPROC)SetClassLongA( WIN_Handle32(hwnd16), offset, (LONG_PTR)new_proc );
694 return (LONG)WINPROC_GetProc16( (WNDPROC)old_proc, FALSE );
696 case GCLP_MENUNAME:
697 newval = (LONG)MapSL( newval );
698 /* fall through */
699 default:
700 return SetClassLongA( WIN_Handle32(hwnd16), offset, newval );
705 /**************************************************************************
706 * GetWindowWord (USER.133)
708 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
710 return GetWindowWord( WIN_Handle32(hwnd), offset );
714 /**************************************************************************
715 * SetWindowWord (USER.134)
717 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
719 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
723 /**************************************************************************
724 * OpenClipboard (USER.137)
726 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
728 return OpenClipboard( WIN_Handle32(hwnd) );
732 /**************************************************************************
733 * GetClipboardOwner (USER.140)
735 HWND16 WINAPI GetClipboardOwner16(void)
737 return HWND_16( GetClipboardOwner() );
741 /**************************************************************************
742 * SetClipboardViewer (USER.147)
744 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
746 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd) ));
750 /**************************************************************************
751 * GetClipboardViewer (USER.148)
753 HWND16 WINAPI GetClipboardViewer16(void)
755 return HWND_16( GetClipboardViewer() );
759 /**************************************************************************
760 * ChangeClipboardChain (USER.149)
762 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
764 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
768 /**************************************************************************
769 * GetSystemMenu (USER.156)
771 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
773 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd), revert ));
777 /**************************************************************************
778 * GetMenu (USER.157)
780 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
782 return HMENU_16(GetMenu( WIN_Handle32(hwnd) ));
786 /**************************************************************************
787 * SetMenu (USER.158)
789 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
791 return SetMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
795 /**************************************************************************
796 * DrawMenuBar (USER.160)
798 void WINAPI DrawMenuBar16( HWND16 hwnd )
800 DrawMenuBar( WIN_Handle32(hwnd) );
804 /**************************************************************************
805 * HiliteMenuItem (USER.162)
807 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
809 return HiliteMenuItem( WIN_Handle32(hwnd), HMENU_32(hMenu), id, wHilite );
813 /**************************************************************************
814 * CreateCaret (USER.163)
816 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
818 CreateCaret( WIN_Handle32(hwnd), HBITMAP_32(bitmap), width, height );
822 /*****************************************************************
823 * DestroyCaret (USER.164)
825 void WINAPI DestroyCaret16(void)
827 DestroyCaret();
831 /*****************************************************************
832 * SetCaretPos (USER.165)
834 void WINAPI SetCaretPos16( INT16 x, INT16 y )
836 SetCaretPos( x, y );
840 /**************************************************************************
841 * HideCaret (USER.166)
843 void WINAPI HideCaret16( HWND16 hwnd )
845 HideCaret( WIN_Handle32(hwnd) );
849 /**************************************************************************
850 * ShowCaret (USER.167)
852 void WINAPI ShowCaret16( HWND16 hwnd )
854 ShowCaret( WIN_Handle32(hwnd) );
858 /*****************************************************************
859 * SetCaretBlinkTime (USER.168)
861 void WINAPI SetCaretBlinkTime16( UINT16 msecs )
863 SetCaretBlinkTime( msecs );
867 /*****************************************************************
868 * GetCaretBlinkTime (USER.169)
870 UINT16 WINAPI GetCaretBlinkTime16(void)
872 return GetCaretBlinkTime();
876 /**************************************************************************
877 * ArrangeIconicWindows (USER.170)
879 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
881 return ArrangeIconicWindows( WIN_Handle32(parent) );
885 /**************************************************************************
886 * SwitchToThisWindow (USER.172)
888 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
890 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
894 /**************************************************************************
895 * KillSystemTimer (USER.182)
897 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
899 return KillSystemTimer( WIN_Handle32(hwnd), id );
903 /*****************************************************************
904 * GetCaretPos (USER.183)
906 void WINAPI GetCaretPos16( LPPOINT16 pt16 )
908 POINT pt;
909 if (GetCaretPos( &pt ))
911 pt16->x = pt.x;
912 pt16->y = pt.y;
917 /**************************************************************************
918 * SetSysModalWindow (USER.188)
920 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
922 HWND16 old = hwndSysModal;
923 hwndSysModal = hwnd;
924 return old;
928 /**************************************************************************
929 * GetSysModalWindow (USER.189)
931 HWND16 WINAPI GetSysModalWindow16(void)
933 return hwndSysModal;
937 /**************************************************************************
938 * GetUpdateRect (USER.190)
940 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
942 RECT r;
943 BOOL16 ret;
945 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
946 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
947 rect->left = r.left;
948 rect->top = r.top;
949 rect->right = r.right;
950 rect->bottom = r.bottom;
951 return ret;
955 /**************************************************************************
956 * ChildWindowFromPoint (USER.191)
958 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
960 POINT pt32;
962 pt32.x = pt.x;
963 pt32.y = pt.y;
964 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
968 /***********************************************************************
969 * GetWindowTask (USER.224)
971 HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
973 DWORD tid = GetWindowThreadProcessId( HWND_32(hwnd), NULL );
974 if (!tid) return 0;
975 return HTASK_16(tid);
978 /**********************************************************************
979 * EnumTaskWindows (USER.225)
981 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
983 struct wnd_enum_info info;
984 DWORD tid = HTASK_32( hTask );
986 if (!tid) return FALSE;
987 info.proc = func;
988 info.param = lParam;
989 return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
993 /**************************************************************************
994 * GetTopWindow (USER.229)
996 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
998 return HWND_16( GetTopWindow( WIN_Handle32(hwnd) ));
1002 /**************************************************************************
1003 * GetNextWindow (USER.230)
1005 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
1007 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
1008 return GetWindow16( hwnd, flag );
1012 /**************************************************************************
1013 * SetWindowPos (USER.232)
1015 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
1016 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
1018 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
1019 x, y, cx, cy, flags );
1023 /**************************************************************************
1024 * SetParent (USER.233)
1026 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
1028 return HWND_16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
1032 /**************************************************************************
1033 * GetCapture (USER.236)
1035 HWND16 WINAPI GetCapture16(void)
1037 return HWND_16( GetCapture() );
1041 /**************************************************************************
1042 * GetUpdateRgn (USER.237)
1044 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
1046 return GetUpdateRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), erase );
1050 /**************************************************************************
1051 * ExcludeUpdateRgn (USER.238)
1053 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
1055 return ExcludeUpdateRgn( HDC_32(hdc), WIN_Handle32(hwnd) );
1059 /**************************************************************************
1060 * GetOpenClipboardWindow (USER.248)
1062 HWND16 WINAPI GetOpenClipboardWindow16(void)
1064 return HWND_16( GetOpenClipboardWindow() );
1068 /**************************************************************************
1069 * BeginDeferWindowPos (USER.259)
1071 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1073 return HDWP_16(BeginDeferWindowPos( count ));
1077 /**************************************************************************
1078 * DeferWindowPos (USER.260)
1080 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1081 INT16 x, INT16 y, INT16 cx, INT16 cy,
1082 UINT16 flags )
1084 return HDWP_16(DeferWindowPos( HDWP_32(hdwp), WIN_Handle32(hwnd),
1085 full_insert_after_hwnd(hwndAfter), x, y, cx, cy, flags ));
1089 /**************************************************************************
1090 * EndDeferWindowPos (USER.261)
1092 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1094 return EndDeferWindowPos(HDWP_32(hdwp));
1098 /**************************************************************************
1099 * GetWindow (USER.262)
1101 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1103 return HWND_16( GetWindow( WIN_Handle32(hwnd), rel ) );
1107 /**************************************************************************
1108 * ShowOwnedPopups (USER.265)
1110 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1112 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1116 /**************************************************************************
1117 * ShowScrollBar (USER.267)
1119 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1121 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1125 /**************************************************************************
1126 * IsZoomed (USER.272)
1128 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1130 return IsZoomed( WIN_Handle32(hwnd) );
1134 /**************************************************************************
1135 * GetDlgCtrlID (USER.277)
1137 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1139 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1143 /**************************************************************************
1144 * GetDesktopHwnd (USER.278)
1146 * Exactly the same thing as GetDesktopWindow(), but not documented.
1147 * Don't ask me why...
1149 HWND16 WINAPI GetDesktopHwnd16(void)
1151 return GetDesktopWindow16();
1155 /**************************************************************************
1156 * SetSystemMenu (USER.280)
1158 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1160 return SetSystemMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
1164 /**************************************************************************
1165 * GetDesktopWindow (USER.286)
1167 HWND16 WINAPI GetDesktopWindow16(void)
1169 return HWND_16( GetDesktopWindow() );
1173 /**************************************************************************
1174 * GetLastActivePopup (USER.287)
1176 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1178 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1182 /**************************************************************************
1183 * RedrawWindow (USER.290)
1185 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1186 HRGN16 hrgnUpdate, UINT16 flags )
1188 if (rectUpdate)
1190 RECT r;
1191 r.left = rectUpdate->left;
1192 r.top = rectUpdate->top;
1193 r.right = rectUpdate->right;
1194 r.bottom = rectUpdate->bottom;
1195 return RedrawWindow(WIN_Handle32(hwnd), &r, HRGN_32(hrgnUpdate), flags);
1197 return RedrawWindow(WIN_Handle32(hwnd), NULL, HRGN_32(hrgnUpdate), flags);
1201 /**************************************************************************
1202 * LockWindowUpdate (USER.294)
1204 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1206 return LockWindowUpdate( WIN_Handle32(hwnd) );
1210 /**************************************************************************
1211 * ScrollWindowEx (USER.319)
1213 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1214 const RECT16 *rect, const RECT16 *clipRect,
1215 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1216 UINT16 flags )
1218 RECT rect32, clipRect32, rcUpdate32;
1219 BOOL16 ret;
1221 if (rect)
1223 rect32.left = rect->left;
1224 rect32.top = rect->top;
1225 rect32.right = rect->right;
1226 rect32.bottom = rect->bottom;
1228 if (clipRect)
1230 clipRect32.left = clipRect->left;
1231 clipRect32.top = clipRect->top;
1232 clipRect32.right = clipRect->right;
1233 clipRect32.bottom = clipRect->bottom;
1235 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1236 clipRect ? &clipRect32 : NULL, HRGN_32(hrgnUpdate),
1237 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1238 if (rcUpdate)
1240 rcUpdate->left = rcUpdate32.left;
1241 rcUpdate->top = rcUpdate32.top;
1242 rcUpdate->right = rcUpdate32.right;
1243 rcUpdate->bottom = rcUpdate32.bottom;
1245 return ret;
1249 /**************************************************************************
1250 * FillWindow (USER.324)
1252 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1254 RECT rect;
1255 RECT16 rc16;
1256 GetClientRect( WIN_Handle32(hwnd), &rect );
1257 DPtoLP( HDC_32(hdc), (LPPOINT)&rect, 2 );
1258 rc16.left = rect.left;
1259 rc16.top = rect.top;
1260 rc16.right = rect.right;
1261 rc16.bottom = rect.bottom;
1262 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1266 /**************************************************************************
1267 * PaintRect (USER.325)
1269 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1270 HBRUSH16 hbrush, const RECT16 *rect)
1272 if (hbrush <= CTLCOLOR_STATIC)
1274 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1276 if (!parent) return;
1277 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1278 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1279 (WPARAM)hdc, (LPARAM)hwnd32 );
1281 if (hbrush) FillRect16( hdc, rect, hbrush );
1285 /**************************************************************************
1286 * GetControlBrush (USER.326)
1288 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1290 HBRUSH16 ret;
1291 HWND hwnd32 = WIN_Handle32(hwnd);
1292 HWND parent = GetParent( hwnd32 );
1294 if (!parent) parent = hwnd32;
1295 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1296 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1297 (WPARAM)hdc, (LPARAM)hwnd32 );
1298 return ret;
1302 /**************************************************************************
1303 * GetDCEx (USER.359)
1305 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1307 return HDC_16(GetDCEx(WIN_Handle32(hwnd), HRGN_32(hrgnClip), flags));
1311 /**************************************************************************
1312 * GetWindowPlacement (USER.370)
1314 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1316 WINDOWPLACEMENT wpl;
1318 wpl.length = sizeof(wpl);
1319 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1320 wp16->length = sizeof(*wp16);
1321 wp16->flags = wpl.flags;
1322 wp16->showCmd = wpl.showCmd;
1323 wp16->ptMinPosition.x = wpl.ptMinPosition.x;
1324 wp16->ptMinPosition.y = wpl.ptMinPosition.y;
1325 wp16->ptMaxPosition.x = wpl.ptMaxPosition.x;
1326 wp16->ptMaxPosition.y = wpl.ptMaxPosition.y;
1327 wp16->rcNormalPosition.left = wpl.rcNormalPosition.left;
1328 wp16->rcNormalPosition.top = wpl.rcNormalPosition.top;
1329 wp16->rcNormalPosition.right = wpl.rcNormalPosition.right;
1330 wp16->rcNormalPosition.bottom = wpl.rcNormalPosition.bottom;
1331 return TRUE;
1335 /**************************************************************************
1336 * SetWindowPlacement (USER.371)
1338 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1340 WINDOWPLACEMENT wpl;
1342 if (!wp16) return FALSE;
1343 wpl.length = sizeof(wpl);
1344 wpl.flags = wp16->flags;
1345 wpl.showCmd = wp16->showCmd;
1346 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1347 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1348 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1349 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1350 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1351 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1352 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1353 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1354 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1358 /***********************************************************************
1359 * RegisterClassEx (USER.397)
1361 ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
1363 WNDCLASSEXA wc32;
1365 wc32.cbSize = sizeof(wc32);
1366 wc32.style = wc->style;
1367 wc32.lpfnWndProc = WINPROC_AllocProc16( wc->lpfnWndProc );
1368 wc32.cbClsExtra = wc->cbClsExtra;
1369 wc32.cbWndExtra = wc->cbWndExtra;
1370 wc32.hInstance = HINSTANCE_32(GetExePtr(wc->hInstance));
1371 if (!wc32.hInstance) wc32.hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
1372 wc32.hIcon = HICON_32(wc->hIcon);
1373 wc32.hCursor = HCURSOR_32(wc->hCursor);
1374 wc32.hbrBackground = HBRUSH_32(wc->hbrBackground);
1375 wc32.lpszMenuName = MapSL(wc->lpszMenuName);
1376 wc32.lpszClassName = MapSL(wc->lpszClassName);
1377 wc32.hIconSm = HICON_32(wc->hIconSm);
1378 return RegisterClassExA( &wc32 );
1382 /***********************************************************************
1383 * GetClassInfoEx (USER.398)
1385 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1386 * same in Win16 as in Win32. --AJ
1388 BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
1390 WNDCLASSEXA wc32;
1391 HINSTANCE hInstance;
1392 BOOL ret;
1394 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1395 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
1397 ret = GetClassInfoExA( hInstance, MapSL(name), &wc32 );
1399 if (ret)
1401 wc->lpfnWndProc = WINPROC_GetProc16( wc32.lpfnWndProc, FALSE );
1402 wc->style = wc32.style;
1403 wc->cbClsExtra = wc32.cbClsExtra;
1404 wc->cbWndExtra = wc32.cbWndExtra;
1405 wc->hInstance = (wc32.hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(wc32.hInstance);
1406 wc->hIcon = HICON_16(wc32.hIcon);
1407 wc->hIconSm = HICON_16(wc32.hIconSm);
1408 wc->hCursor = HCURSOR_16(wc32.hCursor);
1409 wc->hbrBackground = HBRUSH_16(wc32.hbrBackground);
1410 wc->lpszClassName = 0;
1411 wc->lpszMenuName = MapLS(wc32.lpszMenuName); /* FIXME: leak */
1413 return ret;
1417 /**************************************************************************
1418 * ChildWindowFromPointEx (USER.399)
1420 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1422 POINT pt32;
1424 pt32.x = pt.x;
1425 pt32.y = pt.y;
1426 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1430 /**************************************************************************
1431 * GetPriorityClipboardFormat (USER.402)
1433 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1435 int i;
1437 for (i = 0; i < count; i++)
1438 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1439 return -1;
1443 /***********************************************************************
1444 * UnregisterClass (USER.403)
1446 BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
1448 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
1449 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
1453 /***********************************************************************
1454 * GetClassInfo (USER.404)
1456 BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
1458 WNDCLASSEX16 wcex;
1459 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
1461 if (ret)
1463 wc->style = wcex.style;
1464 wc->lpfnWndProc = wcex.lpfnWndProc;
1465 wc->cbClsExtra = wcex.cbClsExtra;
1466 wc->cbWndExtra = wcex.cbWndExtra;
1467 wc->hInstance = wcex.hInstance;
1468 wc->hIcon = wcex.hIcon;
1469 wc->hCursor = wcex.hCursor;
1470 wc->hbrBackground = wcex.hbrBackground;
1471 wc->lpszMenuName = wcex.lpszMenuName;
1472 wc->lpszClassName = wcex.lpszClassName;
1474 return ret;
1478 /**************************************************************************
1479 * TrackPopupMenu (USER.416)
1481 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1482 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1484 RECT r;
1485 if (lpRect)
1487 r.left = lpRect->left;
1488 r.top = lpRect->top;
1489 r.right = lpRect->right;
1490 r.bottom = lpRect->bottom;
1492 return TrackPopupMenu( HMENU_32(hMenu), wFlags, x, y, nReserved,
1493 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1497 /**************************************************************************
1498 * FindWindowEx (USER.427)
1500 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1502 return HWND_16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1503 className, title ));
1507 /***********************************************************************
1508 * DefFrameProc (USER.445)
1510 LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient,
1511 UINT16 message, WPARAM16 wParam, LPARAM lParam )
1513 switch (message)
1515 case WM_SETTEXT:
1516 lParam = (LPARAM)MapSL(lParam);
1517 /* fall through */
1518 case WM_COMMAND:
1519 case WM_NCACTIVATE:
1520 case WM_SETFOCUS:
1521 case WM_SIZE:
1522 return DefFrameProcA( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1523 message, wParam, lParam );
1525 case WM_NEXTMENU:
1527 MDINEXTMENU next_menu;
1528 DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1529 message, wParam, (LPARAM)&next_menu );
1530 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1532 default:
1533 return DefWindowProc16(hwnd, message, wParam, lParam);
1538 /***********************************************************************
1539 * DefMDIChildProc (USER.447)
1541 LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
1542 WPARAM16 wParam, LPARAM lParam )
1544 switch (message)
1546 case WM_SETTEXT:
1547 return DefMDIChildProcA( WIN_Handle32(hwnd), message, wParam, (LPARAM)MapSL(lParam) );
1549 case WM_MENUCHAR:
1550 case WM_CLOSE:
1551 case WM_SETFOCUS:
1552 case WM_CHILDACTIVATE:
1553 case WM_SYSCOMMAND:
1554 case WM_SETVISIBLE:
1555 case WM_SIZE:
1556 case WM_SYSCHAR:
1557 return DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, lParam );
1559 case WM_GETMINMAXINFO:
1561 MINMAXINFO16 *mmi16 = (MINMAXINFO16 *)MapSL(lParam);
1562 MINMAXINFO mmi;
1564 mmi.ptReserved.x = mmi16->ptReserved.x;
1565 mmi.ptReserved.y = mmi16->ptReserved.y;
1566 mmi.ptMaxSize.x = mmi16->ptMaxSize.x;
1567 mmi.ptMaxSize.y = mmi16->ptMaxSize.y;
1568 mmi.ptMaxPosition.x = mmi16->ptMaxPosition.x;
1569 mmi.ptMaxPosition.y = mmi16->ptMaxPosition.y;
1570 mmi.ptMinTrackSize.x = mmi16->ptMinTrackSize.x;
1571 mmi.ptMinTrackSize.y = mmi16->ptMinTrackSize.y;
1572 mmi.ptMaxTrackSize.x = mmi16->ptMaxTrackSize.x;
1573 mmi.ptMaxTrackSize.y = mmi16->ptMaxTrackSize.y;
1575 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&mmi );
1577 mmi16->ptReserved.x = mmi.ptReserved.x;
1578 mmi16->ptReserved.y = mmi.ptReserved.y;
1579 mmi16->ptMaxSize.x = mmi.ptMaxSize.x;
1580 mmi16->ptMaxSize.y = mmi.ptMaxSize.y;
1581 mmi16->ptMaxPosition.x = mmi.ptMaxPosition.x;
1582 mmi16->ptMaxPosition.y = mmi.ptMaxPosition.y;
1583 mmi16->ptMinTrackSize.x = mmi.ptMinTrackSize.x;
1584 mmi16->ptMinTrackSize.y = mmi.ptMinTrackSize.y;
1585 mmi16->ptMaxTrackSize.x = mmi.ptMaxTrackSize.x;
1586 mmi16->ptMaxTrackSize.y = mmi.ptMaxTrackSize.y;
1587 return 0;
1589 case WM_NEXTMENU:
1591 MDINEXTMENU next_menu;
1592 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
1593 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1595 default:
1596 return DefWindowProc16(hwnd, message, wParam, lParam);
1601 /**************************************************************************
1602 * DrawAnimatedRects (USER.448)
1604 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1605 const RECT16* lprcFrom, const RECT16* lprcTo )
1607 RECT rcFrom32, rcTo32;
1608 rcFrom32.left = lprcFrom->left;
1609 rcFrom32.top = lprcFrom->top;
1610 rcFrom32.right = lprcFrom->right;
1611 rcFrom32.bottom = lprcFrom->bottom;
1612 rcTo32.left = lprcTo->left;
1613 rcTo32.top = lprcTo->top;
1614 rcTo32.right = lprcTo->right;
1615 rcTo32.bottom = lprcTo->bottom;
1616 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1620 /***********************************************************************
1621 * GetInternalWindowPos (USER.460)
1623 UINT16 WINAPI GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd, LPPOINT16 ptIcon )
1625 WINDOWPLACEMENT16 wndpl;
1627 if (!GetWindowPlacement16( hwnd, &wndpl )) return 0;
1628 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1629 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1630 return wndpl.showCmd;
1634 /**************************************************************************
1635 * SetInternalWindowPos (USER.461)
1637 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1639 RECT rc32;
1640 POINT pt32;
1642 if (rect)
1644 rc32.left = rect->left;
1645 rc32.top = rect->top;
1646 rc32.right = rect->right;
1647 rc32.bottom = rect->bottom;
1649 if (pt)
1651 pt32.x = pt->x;
1652 pt32.y = pt->y;
1654 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1655 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1659 /**************************************************************************
1660 * CalcChildScroll (USER.462)
1662 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1664 CalcChildScroll( WIN_Handle32(hwnd), scroll );
1668 /**************************************************************************
1669 * ScrollChildren (USER.463)
1671 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1673 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1677 /**************************************************************************
1678 * DragDetect (USER.465)
1680 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1682 POINT pt32;
1684 pt32.x = pt.x;
1685 pt32.y = pt.y;
1686 return DragDetect( WIN_Handle32(hwnd), pt32 );
1690 /**************************************************************************
1691 * SetScrollInfo (USER.475)
1693 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1695 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1699 /**************************************************************************
1700 * GetScrollInfo (USER.476)
1702 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1704 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1708 /**************************************************************************
1709 * EnableScrollBar (USER.482)
1711 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1713 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1717 /**************************************************************************
1718 * GetShellWindow (USER.600)
1720 HWND16 WINAPI GetShellWindow16(void)
1722 return HWND_16( GetShellWindow() );
1726 /**************************************************************************
1727 * GetForegroundWindow (USER.608)
1729 HWND16 WINAPI GetForegroundWindow16(void)
1731 return HWND_16( GetForegroundWindow() );
1735 /**************************************************************************
1736 * SetForegroundWindow (USER.609)
1738 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1740 return SetForegroundWindow( WIN_Handle32(hwnd) );
1744 /**************************************************************************
1745 * DrawCaptionTemp (USER.657)
1747 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1748 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1750 RECT rect32;
1752 if (rect)
1754 rect32.left = rect->left;
1755 rect32.top = rect->top;
1756 rect32.right = rect->right;
1757 rect32.bottom = rect->bottom;
1759 return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc),
1760 rect ? &rect32 : NULL, HFONT_32(hFont),
1761 HICON_32(hIcon), str, uFlags & 0x1f );
1765 /**************************************************************************
1766 * DrawCaption (USER.660)
1768 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1770 RECT rect32;
1772 if (rect)
1774 rect32.left = rect->left;
1775 rect32.top = rect->top;
1776 rect32.right = rect->right;
1777 rect32.bottom = rect->bottom;
1779 return DrawCaption(WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, flags);
1783 /**************************************************************************
1784 * GetMenuItemRect (USER.665)
1786 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1787 LPRECT16 rect)
1789 RECT r32;
1790 BOOL res;
1791 if (!rect) return FALSE;
1792 res = GetMenuItemRect( WIN_Handle32(hwnd), HMENU_32(hMenu), uItem, &r32 );
1793 rect->left = r32.left;
1794 rect->top = r32.top;
1795 rect->right = r32.right;
1796 rect->bottom = r32.bottom;
1797 return res;
1801 /**************************************************************************
1802 * SetWindowRgn (USER.668)
1804 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1806 return SetWindowRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), redraw );
1810 /**************************************************************************
1811 * MessageBoxIndirect (USER.827)
1813 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1815 MSGBOXPARAMSA msgbox32;
1817 msgbox32.cbSize = msgbox->cbSize;
1818 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1819 msgbox32.hInstance = HINSTANCE_32(msgbox->hInstance);
1820 msgbox32.lpszText = MapSL(msgbox->lpszText);
1821 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1822 msgbox32.dwStyle = msgbox->dwStyle;
1823 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1824 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1825 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1826 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1827 return MessageBoxIndirectA( &msgbox32 );