[02/10] user: Create 32-bit cursor handles
[wine/hacks.git] / dlls / user32 / wnd16.c
blobd6f6c2728223ffd43aa8219d3c6d9acd38bdccde
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 "user_private.h"
26 /* handle <--> handle16 conversions */
27 #define HANDLE_16(h32) (LOWORD(h32))
28 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
30 static HWND16 hwndSysModal;
32 struct wnd_enum_info
34 WNDENUMPROC16 proc;
35 LPARAM param;
38 /* callback for 16-bit window enumeration functions */
39 static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param )
41 const struct wnd_enum_info *info = (struct wnd_enum_info *)param;
42 WORD args[3];
43 DWORD ret;
45 args[2] = HWND_16(hwnd);
46 args[1] = HIWORD(info->param);
47 args[0] = LOWORD(info->param);
48 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
49 return LOWORD(ret);
52 /* convert insert after window handle to 32-bit */
53 static inline HWND full_insert_after_hwnd( HWND16 hwnd )
55 HWND ret = WIN_Handle32( hwnd );
56 if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
57 return ret;
60 /**************************************************************************
61 * MessageBox (USER.1)
63 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
65 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
69 /***********************************************************************
70 * SetTimer (USER.10)
72 UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
74 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
75 return SetTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
79 /***********************************************************************
80 * SetSystemTimer (USER.11)
82 UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
84 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
85 return SetSystemTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
89 /**************************************************************************
90 * KillTimer (USER.12)
92 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
94 return KillTimer( WIN_Handle32(hwnd), id );
98 /**************************************************************************
99 * SetCapture (USER.18)
101 HWND16 WINAPI SetCapture16( HWND16 hwnd )
103 return HWND_16( SetCapture( WIN_Handle32(hwnd) ));
107 /**************************************************************************
108 * ReleaseCapture (USER.19)
110 BOOL16 WINAPI ReleaseCapture16(void)
112 return ReleaseCapture();
116 /**************************************************************************
117 * SetFocus (USER.22)
119 HWND16 WINAPI SetFocus16( HWND16 hwnd )
121 return HWND_16( SetFocus( WIN_Handle32(hwnd) ));
125 /**************************************************************************
126 * GetFocus (USER.23)
128 HWND16 WINAPI GetFocus16(void)
130 return HWND_16( GetFocus() );
134 /**************************************************************************
135 * RemoveProp (USER.24)
137 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
139 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd), str ));
143 /**************************************************************************
144 * GetProp (USER.25)
146 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
148 return HANDLE_16(GetPropA( WIN_Handle32(hwnd), str ));
152 /**************************************************************************
153 * SetProp (USER.26)
155 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
157 return SetPropA( WIN_Handle32(hwnd), str, HANDLE_32(handle) );
161 /**************************************************************************
162 * ClientToScreen (USER.28)
164 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
166 MapWindowPoints16( hwnd, 0, lppnt, 1 );
170 /**************************************************************************
171 * ScreenToClient (USER.29)
173 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
175 MapWindowPoints16( 0, hwnd, lppnt, 1 );
179 /**************************************************************************
180 * WindowFromPoint (USER.30)
182 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
184 POINT pt32;
186 pt32.x = pt.x;
187 pt32.y = pt.y;
188 return HWND_16( WindowFromPoint( pt32 ) );
192 /**************************************************************************
193 * IsIconic (USER.31)
195 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
197 return IsIconic( WIN_Handle32(hwnd) );
201 /**************************************************************************
202 * GetWindowRect (USER.32)
204 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
206 RECT rect32;
208 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
209 rect->left = rect32.left;
210 rect->top = rect32.top;
211 rect->right = rect32.right;
212 rect->bottom = rect32.bottom;
216 /**************************************************************************
217 * GetClientRect (USER.33)
219 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
221 RECT rect32;
223 GetClientRect( WIN_Handle32(hwnd), &rect32 );
224 rect->left = rect32.left;
225 rect->top = rect32.top;
226 rect->right = rect32.right;
227 rect->bottom = rect32.bottom;
231 /**************************************************************************
232 * EnableWindow (USER.34)
234 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
236 return EnableWindow( WIN_Handle32(hwnd), enable );
240 /**************************************************************************
241 * IsWindowEnabled (USER.35)
243 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
245 return IsWindowEnabled( WIN_Handle32(hwnd) );
249 /**************************************************************************
250 * GetWindowText (USER.36)
252 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
254 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
258 /**************************************************************************
259 * SetWindowText (USER.37)
261 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
263 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
267 /**************************************************************************
268 * GetWindowTextLength (USER.38)
270 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
272 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
276 /***********************************************************************
277 * BeginPaint (USER.39)
279 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
281 PAINTSTRUCT ps;
283 BeginPaint( WIN_Handle32(hwnd), &ps );
284 lps->hdc = HDC_16(ps.hdc);
285 lps->fErase = ps.fErase;
286 lps->rcPaint.top = ps.rcPaint.top;
287 lps->rcPaint.left = ps.rcPaint.left;
288 lps->rcPaint.right = ps.rcPaint.right;
289 lps->rcPaint.bottom = ps.rcPaint.bottom;
290 lps->fRestore = ps.fRestore;
291 lps->fIncUpdate = ps.fIncUpdate;
292 return lps->hdc;
296 /***********************************************************************
297 * EndPaint (USER.40)
299 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
301 PAINTSTRUCT ps;
303 ps.hdc = HDC_32(lps->hdc);
304 return EndPaint( WIN_Handle32(hwnd), &ps );
308 /**************************************************************************
309 * ShowWindow (USER.42)
311 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
313 return ShowWindow( WIN_Handle32(hwnd), cmd );
317 /**************************************************************************
318 * CloseWindow (USER.43)
320 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
322 return CloseWindow( WIN_Handle32(hwnd) );
326 /**************************************************************************
327 * OpenIcon (USER.44)
329 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
331 return OpenIcon( WIN_Handle32(hwnd) );
335 /**************************************************************************
336 * BringWindowToTop (USER.45)
338 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
340 return BringWindowToTop( WIN_Handle32(hwnd) );
344 /**************************************************************************
345 * GetParent (USER.46)
347 HWND16 WINAPI GetParent16( HWND16 hwnd )
349 return HWND_16( GetParent( WIN_Handle32(hwnd) ));
353 /**************************************************************************
354 * IsWindow (USER.47)
356 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
358 STACK16FRAME *frame = MapSL( (SEGPTR)NtCurrentTeb()->WOW32Reserved );
359 frame->es = USER_HeapSel;
360 /* don't use WIN_Handle32 here, we don't care about the full handle */
361 return IsWindow( HWND_32(hwnd) );
365 /**************************************************************************
366 * IsChild (USER.48)
368 BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
370 return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
374 /**************************************************************************
375 * IsWindowVisible (USER.49)
377 BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
379 return IsWindowVisible( WIN_Handle32(hwnd) );
383 /**************************************************************************
384 * FindWindow (USER.50)
386 HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
388 return HWND_16( FindWindowA( className, title ));
392 /**************************************************************************
393 * DestroyWindow (USER.53)
395 BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
397 return DestroyWindow( WIN_Handle32(hwnd) );
401 /*******************************************************************
402 * EnumWindows (USER.54)
404 BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
406 struct wnd_enum_info info;
408 info.proc = func;
409 info.param = lParam;
410 return EnumWindows( wnd_enum_callback, (LPARAM)&info );
414 /**********************************************************************
415 * EnumChildWindows (USER.55)
417 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
419 struct wnd_enum_info info;
421 info.proc = func;
422 info.param = lParam;
423 return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info );
427 /**************************************************************************
428 * MoveWindow (USER.56)
430 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
432 return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
436 /***********************************************************************
437 * RegisterClass (USER.57)
439 ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
441 WNDCLASSEX16 wcex;
443 wcex.cbSize = sizeof(wcex);
444 wcex.style = wc->style;
445 wcex.lpfnWndProc = wc->lpfnWndProc;
446 wcex.cbClsExtra = wc->cbClsExtra;
447 wcex.cbWndExtra = wc->cbWndExtra;
448 wcex.hInstance = wc->hInstance;
449 wcex.hIcon = wc->hIcon;
450 wcex.hCursor = wc->hCursor;
451 wcex.hbrBackground = wc->hbrBackground;
452 wcex.lpszMenuName = wc->lpszMenuName;
453 wcex.lpszClassName = wc->lpszClassName;
454 wcex.hIconSm = 0;
455 return RegisterClassEx16( &wcex );
459 /**************************************************************************
460 * GetClassName (USER.58)
462 INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
464 return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
468 /**************************************************************************
469 * SetActiveWindow (USER.59)
471 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
473 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd) ));
477 /**************************************************************************
478 * GetActiveWindow (USER.60)
480 HWND16 WINAPI GetActiveWindow16(void)
482 return HWND_16( GetActiveWindow() );
486 /**************************************************************************
487 * ScrollWindow (USER.61)
489 void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
490 const RECT16 *clipRect )
492 RECT rect32, clipRect32;
494 if (rect)
496 rect32.left = rect->left;
497 rect32.top = rect->top;
498 rect32.right = rect->right;
499 rect32.bottom = rect->bottom;
501 if (clipRect)
503 clipRect32.left = clipRect->left;
504 clipRect32.top = clipRect->top;
505 clipRect32.right = clipRect->right;
506 clipRect32.bottom = clipRect->bottom;
508 ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
509 clipRect ? &clipRect32 : NULL );
513 /**************************************************************************
514 * SetScrollPos (USER.62)
516 INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
518 return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
522 /**************************************************************************
523 * GetScrollPos (USER.63)
525 INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
527 return GetScrollPos( WIN_Handle32(hwnd), nBar );
531 /**************************************************************************
532 * SetScrollRange (USER.64)
534 void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
536 /* Invalid range -> range is set to (0,0) */
537 if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
538 SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
542 /**************************************************************************
543 * GetScrollRange (USER.65)
545 BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
547 INT min, max;
548 BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
549 if (lpMin) *lpMin = min;
550 if (lpMax) *lpMax = max;
551 return ret;
555 /**************************************************************************
556 * GetDC (USER.66)
558 HDC16 WINAPI GetDC16( HWND16 hwnd )
560 return HDC_16(GetDC( WIN_Handle32(hwnd) ));
564 /**************************************************************************
565 * GetWindowDC (USER.67)
567 HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
569 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
573 /**************************************************************************
574 * ReleaseDC (USER.68)
576 INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
578 return (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) );
582 /**************************************************************************
583 * FlashWindow (USER.105)
585 BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
587 return FlashWindow( WIN_Handle32(hwnd), bInvert );
591 /**************************************************************************
592 * WindowFromDC (USER.117)
594 HWND16 WINAPI WindowFromDC16( HDC16 hDC )
596 return HWND_16( WindowFromDC( HDC_32(hDC) ) );
600 /**************************************************************************
601 * UpdateWindow (USER.124)
603 void WINAPI UpdateWindow16( HWND16 hwnd )
605 RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
609 /**************************************************************************
610 * InvalidateRect (USER.125)
612 void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
614 RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
618 /**************************************************************************
619 * InvalidateRgn (USER.126)
621 void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
623 RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
627 /**************************************************************************
628 * ValidateRect (USER.127)
630 void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
632 RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
636 /**************************************************************************
637 * ValidateRgn (USER.128)
639 void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
641 RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
645 /**************************************************************************
646 * GetClassWord (USER.129)
648 WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
650 WORD ret = GetClassWord( WIN_Handle32(hwnd), offset );
652 switch (offset)
654 case GCLP_HCURSOR:
655 case GCLP_HICON:
656 case GCLP_HICONSM:
657 return HCURSOR_16((HCURSOR)(LONG_PTR)ret);
658 default:
659 return ret;
664 /**************************************************************************
665 * SetClassWord (USER.130)
667 WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
669 switch (offset)
671 case GCLP_HCURSOR:
672 case GCLP_HICON:
673 case GCLP_HICONSM:
674 return HCURSOR_16((HCURSOR)SetClassLongW( WIN_Handle32(hwnd), offset, (LONG_PTR)HCURSOR_32(newval) ));
675 default:
676 return SetClassWord( WIN_Handle32(hwnd), offset, newval );
681 /***********************************************************************
682 * GetClassLong (USER.131)
684 LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
686 LONG_PTR ret = GetClassLongA( WIN_Handle32(hwnd16), offset );
688 switch( offset )
690 case GCLP_HCURSOR:
691 case GCLP_HICON:
692 case GCLP_HICONSM:
693 return HCURSOR_16((HCURSOR)ret);
694 case GCLP_WNDPROC:
695 return (LONG_PTR)WINPROC_GetProc16( (WNDPROC)ret, FALSE );
696 case GCLP_MENUNAME:
697 return MapLS( (void *)ret ); /* leak */
698 default:
699 return ret;
704 /***********************************************************************
705 * SetClassLong (USER.132)
707 LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
709 switch( offset )
711 case GCLP_HCURSOR:
712 case GCLP_HICON:
713 case GCLP_HICONSM:
714 return HCURSOR_16((HCURSOR)SetClassLongW( WIN_Handle32(hwnd16), offset, (LONG_PTR)HCURSOR_32( newval ) ));
715 case GCLP_WNDPROC:
717 WNDPROC new_proc = WINPROC_AllocProc16( (WNDPROC16)newval );
718 WNDPROC old_proc = (WNDPROC)SetClassLongA( WIN_Handle32(hwnd16), offset, (LONG_PTR)new_proc );
719 return (LONG)WINPROC_GetProc16( old_proc, FALSE );
721 case GCLP_MENUNAME:
722 newval = (LONG)MapSL( newval );
723 /* fall through */
724 default:
725 return SetClassLongA( WIN_Handle32(hwnd16), offset, newval );
730 /**************************************************************************
731 * GetWindowWord (USER.133)
733 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
735 return GetWindowWord( WIN_Handle32(hwnd), offset );
739 /**************************************************************************
740 * SetWindowWord (USER.134)
742 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
744 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
748 /**************************************************************************
749 * OpenClipboard (USER.137)
751 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
753 return OpenClipboard( WIN_Handle32(hwnd) );
757 /**************************************************************************
758 * GetClipboardOwner (USER.140)
760 HWND16 WINAPI GetClipboardOwner16(void)
762 return HWND_16( GetClipboardOwner() );
766 /**************************************************************************
767 * SetClipboardViewer (USER.147)
769 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
771 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd) ));
775 /**************************************************************************
776 * GetClipboardViewer (USER.148)
778 HWND16 WINAPI GetClipboardViewer16(void)
780 return HWND_16( GetClipboardViewer() );
784 /**************************************************************************
785 * ChangeClipboardChain (USER.149)
787 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
789 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
793 /**************************************************************************
794 * GetSystemMenu (USER.156)
796 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
798 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd), revert ));
802 /**************************************************************************
803 * GetMenu (USER.157)
805 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
807 return HMENU_16(GetMenu( WIN_Handle32(hwnd) ));
811 /**************************************************************************
812 * SetMenu (USER.158)
814 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
816 return SetMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
820 /**************************************************************************
821 * DrawMenuBar (USER.160)
823 void WINAPI DrawMenuBar16( HWND16 hwnd )
825 DrawMenuBar( WIN_Handle32(hwnd) );
829 /**************************************************************************
830 * HiliteMenuItem (USER.162)
832 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
834 return HiliteMenuItem( WIN_Handle32(hwnd), HMENU_32(hMenu), id, wHilite );
838 /**************************************************************************
839 * CreateCaret (USER.163)
841 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
843 CreateCaret( WIN_Handle32(hwnd), HBITMAP_32(bitmap), width, height );
847 /*****************************************************************
848 * DestroyCaret (USER.164)
850 void WINAPI DestroyCaret16(void)
852 DestroyCaret();
856 /*****************************************************************
857 * SetCaretPos (USER.165)
859 void WINAPI SetCaretPos16( INT16 x, INT16 y )
861 SetCaretPos( x, y );
865 /**************************************************************************
866 * HideCaret (USER.166)
868 void WINAPI HideCaret16( HWND16 hwnd )
870 HideCaret( WIN_Handle32(hwnd) );
874 /**************************************************************************
875 * ShowCaret (USER.167)
877 void WINAPI ShowCaret16( HWND16 hwnd )
879 ShowCaret( WIN_Handle32(hwnd) );
883 /*****************************************************************
884 * SetCaretBlinkTime (USER.168)
886 void WINAPI SetCaretBlinkTime16( UINT16 msecs )
888 SetCaretBlinkTime( msecs );
892 /*****************************************************************
893 * GetCaretBlinkTime (USER.169)
895 UINT16 WINAPI GetCaretBlinkTime16(void)
897 return GetCaretBlinkTime();
901 /**************************************************************************
902 * ArrangeIconicWindows (USER.170)
904 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
906 return ArrangeIconicWindows( WIN_Handle32(parent) );
910 /**************************************************************************
911 * SwitchToThisWindow (USER.172)
913 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
915 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
919 /**************************************************************************
920 * KillSystemTimer (USER.182)
922 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
924 return KillSystemTimer( WIN_Handle32(hwnd), id );
928 /*****************************************************************
929 * GetCaretPos (USER.183)
931 void WINAPI GetCaretPos16( LPPOINT16 pt16 )
933 POINT pt;
934 if (GetCaretPos( &pt ))
936 pt16->x = pt.x;
937 pt16->y = pt.y;
942 /**************************************************************************
943 * SetSysModalWindow (USER.188)
945 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
947 HWND16 old = hwndSysModal;
948 hwndSysModal = hwnd;
949 return old;
953 /**************************************************************************
954 * GetSysModalWindow (USER.189)
956 HWND16 WINAPI GetSysModalWindow16(void)
958 return hwndSysModal;
962 /**************************************************************************
963 * GetUpdateRect (USER.190)
965 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
967 RECT r;
968 BOOL16 ret;
970 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
971 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
972 rect->left = r.left;
973 rect->top = r.top;
974 rect->right = r.right;
975 rect->bottom = r.bottom;
976 return ret;
980 /**************************************************************************
981 * ChildWindowFromPoint (USER.191)
983 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
985 POINT pt32;
987 pt32.x = pt.x;
988 pt32.y = pt.y;
989 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
993 /***********************************************************************
994 * CascadeChildWindows (USER.198)
996 void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
998 CascadeWindows( WIN_Handle32(parent), action, NULL, 0, NULL );
1002 /***********************************************************************
1003 * TileChildWindows (USER.199)
1005 void WINAPI TileChildWindows16( HWND16 parent, WORD action )
1007 TileWindows( WIN_Handle32(parent), action, NULL, 0, NULL );
1011 /***********************************************************************
1012 * GetWindowTask (USER.224)
1014 HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
1016 DWORD tid = GetWindowThreadProcessId( HWND_32(hwnd), NULL );
1017 if (!tid) return 0;
1018 return HTASK_16(tid);
1021 /**********************************************************************
1022 * EnumTaskWindows (USER.225)
1024 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
1026 struct wnd_enum_info info;
1027 DWORD tid = HTASK_32( hTask );
1029 if (!tid) return FALSE;
1030 info.proc = func;
1031 info.param = lParam;
1032 return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
1036 /**************************************************************************
1037 * GetTopWindow (USER.229)
1039 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
1041 return HWND_16( GetTopWindow( WIN_Handle32(hwnd) ));
1045 /**************************************************************************
1046 * GetNextWindow (USER.230)
1048 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
1050 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
1051 return GetWindow16( hwnd, flag );
1055 /**************************************************************************
1056 * SetWindowPos (USER.232)
1058 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
1059 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
1061 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
1062 x, y, cx, cy, flags );
1066 /**************************************************************************
1067 * SetParent (USER.233)
1069 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
1071 return HWND_16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
1075 /**************************************************************************
1076 * GetCapture (USER.236)
1078 HWND16 WINAPI GetCapture16(void)
1080 return HWND_16( GetCapture() );
1084 /**************************************************************************
1085 * GetUpdateRgn (USER.237)
1087 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
1089 return GetUpdateRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), erase );
1093 /**************************************************************************
1094 * ExcludeUpdateRgn (USER.238)
1096 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
1098 return ExcludeUpdateRgn( HDC_32(hdc), WIN_Handle32(hwnd) );
1102 /**************************************************************************
1103 * GetOpenClipboardWindow (USER.248)
1105 HWND16 WINAPI GetOpenClipboardWindow16(void)
1107 return HWND_16( GetOpenClipboardWindow() );
1111 /**************************************************************************
1112 * BeginDeferWindowPos (USER.259)
1114 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1116 return HDWP_16(BeginDeferWindowPos( count ));
1120 /**************************************************************************
1121 * DeferWindowPos (USER.260)
1123 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1124 INT16 x, INT16 y, INT16 cx, INT16 cy,
1125 UINT16 flags )
1127 return HDWP_16(DeferWindowPos( HDWP_32(hdwp), WIN_Handle32(hwnd),
1128 full_insert_after_hwnd(hwndAfter), x, y, cx, cy, flags ));
1132 /**************************************************************************
1133 * EndDeferWindowPos (USER.261)
1135 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1137 return EndDeferWindowPos(HDWP_32(hdwp));
1141 /**************************************************************************
1142 * GetWindow (USER.262)
1144 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1146 return HWND_16( GetWindow( WIN_Handle32(hwnd), rel ) );
1150 /**************************************************************************
1151 * ShowOwnedPopups (USER.265)
1153 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1155 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1159 /**************************************************************************
1160 * ShowScrollBar (USER.267)
1162 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1164 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1168 /**************************************************************************
1169 * IsZoomed (USER.272)
1171 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1173 return IsZoomed( WIN_Handle32(hwnd) );
1177 /**************************************************************************
1178 * GetDlgCtrlID (USER.277)
1180 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1182 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1186 /**************************************************************************
1187 * GetDesktopHwnd (USER.278)
1189 * Exactly the same thing as GetDesktopWindow(), but not documented.
1190 * Don't ask me why...
1192 HWND16 WINAPI GetDesktopHwnd16(void)
1194 return GetDesktopWindow16();
1198 /**************************************************************************
1199 * SetSystemMenu (USER.280)
1201 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1203 return SetSystemMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
1207 /**************************************************************************
1208 * GetDesktopWindow (USER.286)
1210 HWND16 WINAPI GetDesktopWindow16(void)
1212 return HWND_16( GetDesktopWindow() );
1216 /**************************************************************************
1217 * GetLastActivePopup (USER.287)
1219 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1221 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1225 /**************************************************************************
1226 * RedrawWindow (USER.290)
1228 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1229 HRGN16 hrgnUpdate, UINT16 flags )
1231 if (rectUpdate)
1233 RECT r;
1234 r.left = rectUpdate->left;
1235 r.top = rectUpdate->top;
1236 r.right = rectUpdate->right;
1237 r.bottom = rectUpdate->bottom;
1238 return RedrawWindow(WIN_Handle32(hwnd), &r, HRGN_32(hrgnUpdate), flags);
1240 return RedrawWindow(WIN_Handle32(hwnd), NULL, HRGN_32(hrgnUpdate), flags);
1244 /**************************************************************************
1245 * LockWindowUpdate (USER.294)
1247 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1249 return LockWindowUpdate( WIN_Handle32(hwnd) );
1253 /**************************************************************************
1254 * ScrollWindowEx (USER.319)
1256 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1257 const RECT16 *rect, const RECT16 *clipRect,
1258 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1259 UINT16 flags )
1261 RECT rect32, clipRect32, rcUpdate32;
1262 BOOL16 ret;
1264 if (rect)
1266 rect32.left = rect->left;
1267 rect32.top = rect->top;
1268 rect32.right = rect->right;
1269 rect32.bottom = rect->bottom;
1271 if (clipRect)
1273 clipRect32.left = clipRect->left;
1274 clipRect32.top = clipRect->top;
1275 clipRect32.right = clipRect->right;
1276 clipRect32.bottom = clipRect->bottom;
1278 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1279 clipRect ? &clipRect32 : NULL, HRGN_32(hrgnUpdate),
1280 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1281 if (rcUpdate)
1283 rcUpdate->left = rcUpdate32.left;
1284 rcUpdate->top = rcUpdate32.top;
1285 rcUpdate->right = rcUpdate32.right;
1286 rcUpdate->bottom = rcUpdate32.bottom;
1288 return ret;
1292 /**************************************************************************
1293 * FillWindow (USER.324)
1295 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1297 RECT rect;
1298 RECT16 rc16;
1299 GetClientRect( WIN_Handle32(hwnd), &rect );
1300 DPtoLP( HDC_32(hdc), (LPPOINT)&rect, 2 );
1301 rc16.left = rect.left;
1302 rc16.top = rect.top;
1303 rc16.right = rect.right;
1304 rc16.bottom = rect.bottom;
1305 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1309 /**************************************************************************
1310 * PaintRect (USER.325)
1312 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1313 HBRUSH16 hbrush, const RECT16 *rect)
1315 if (hbrush <= CTLCOLOR_STATIC)
1317 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1319 if (!parent) return;
1320 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1321 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1322 (WPARAM)hdc, (LPARAM)hwnd32 );
1324 if (hbrush) FillRect16( hdc, rect, hbrush );
1328 /**************************************************************************
1329 * GetControlBrush (USER.326)
1331 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1333 HBRUSH16 ret;
1334 HWND hwnd32 = WIN_Handle32(hwnd);
1335 HWND parent = GetParent( hwnd32 );
1337 if (!parent) parent = hwnd32;
1338 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1339 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1340 (WPARAM)hdc, (LPARAM)hwnd32 );
1341 return ret;
1345 /**************************************************************************
1346 * GetDCEx (USER.359)
1348 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1350 return HDC_16(GetDCEx(WIN_Handle32(hwnd), HRGN_32(hrgnClip), flags));
1354 /**************************************************************************
1355 * GetWindowPlacement (USER.370)
1357 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1359 WINDOWPLACEMENT wpl;
1361 wpl.length = sizeof(wpl);
1362 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1363 wp16->length = sizeof(*wp16);
1364 wp16->flags = wpl.flags;
1365 wp16->showCmd = wpl.showCmd;
1366 wp16->ptMinPosition.x = wpl.ptMinPosition.x;
1367 wp16->ptMinPosition.y = wpl.ptMinPosition.y;
1368 wp16->ptMaxPosition.x = wpl.ptMaxPosition.x;
1369 wp16->ptMaxPosition.y = wpl.ptMaxPosition.y;
1370 wp16->rcNormalPosition.left = wpl.rcNormalPosition.left;
1371 wp16->rcNormalPosition.top = wpl.rcNormalPosition.top;
1372 wp16->rcNormalPosition.right = wpl.rcNormalPosition.right;
1373 wp16->rcNormalPosition.bottom = wpl.rcNormalPosition.bottom;
1374 return TRUE;
1378 /**************************************************************************
1379 * SetWindowPlacement (USER.371)
1381 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1383 WINDOWPLACEMENT wpl;
1385 if (!wp16) return FALSE;
1386 wpl.length = sizeof(wpl);
1387 wpl.flags = wp16->flags;
1388 wpl.showCmd = wp16->showCmd;
1389 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1390 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1391 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1392 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1393 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1394 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1395 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1396 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1397 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1401 /***********************************************************************
1402 * RegisterClassEx (USER.397)
1404 ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
1406 WNDCLASSEXA wc32;
1408 wc32.cbSize = sizeof(wc32);
1409 wc32.style = wc->style;
1410 wc32.lpfnWndProc = WINPROC_AllocProc16( wc->lpfnWndProc );
1411 wc32.cbClsExtra = wc->cbClsExtra;
1412 wc32.cbWndExtra = wc->cbWndExtra;
1413 wc32.hInstance = HINSTANCE_32(GetExePtr(wc->hInstance));
1414 if (!wc32.hInstance) wc32.hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
1415 wc32.hIcon = HICON_32(wc->hIcon);
1416 wc32.hCursor = HCURSOR_32(wc->hCursor);
1417 wc32.hbrBackground = HBRUSH_32(wc->hbrBackground);
1418 wc32.lpszMenuName = MapSL(wc->lpszMenuName);
1419 wc32.lpszClassName = MapSL(wc->lpszClassName);
1420 wc32.hIconSm = HICON_32(wc->hIconSm);
1421 return RegisterClassExA( &wc32 );
1425 /***********************************************************************
1426 * GetClassInfoEx (USER.398)
1428 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1429 * same in Win16 as in Win32. --AJ
1431 BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
1433 WNDCLASSEXA wc32;
1434 HINSTANCE hInstance;
1435 BOOL ret;
1437 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1438 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
1440 ret = GetClassInfoExA( hInstance, MapSL(name), &wc32 );
1442 if (ret)
1444 wc->lpfnWndProc = WINPROC_GetProc16( wc32.lpfnWndProc, FALSE );
1445 wc->style = wc32.style;
1446 wc->cbClsExtra = wc32.cbClsExtra;
1447 wc->cbWndExtra = wc32.cbWndExtra;
1448 wc->hInstance = (wc32.hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(wc32.hInstance);
1449 wc->hIcon = HICON_16(wc32.hIcon);
1450 wc->hIconSm = HICON_16(wc32.hIconSm);
1451 wc->hCursor = HCURSOR_16(wc32.hCursor);
1452 wc->hbrBackground = HBRUSH_16(wc32.hbrBackground);
1453 wc->lpszClassName = 0;
1454 wc->lpszMenuName = MapLS(wc32.lpszMenuName); /* FIXME: leak */
1456 return ret;
1460 /**************************************************************************
1461 * ChildWindowFromPointEx (USER.399)
1463 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1465 POINT pt32;
1467 pt32.x = pt.x;
1468 pt32.y = pt.y;
1469 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1473 /**************************************************************************
1474 * GetPriorityClipboardFormat (USER.402)
1476 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1478 int i;
1480 for (i = 0; i < count; i++)
1481 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1482 return -1;
1486 /***********************************************************************
1487 * UnregisterClass (USER.403)
1489 BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
1491 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
1492 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
1496 /***********************************************************************
1497 * GetClassInfo (USER.404)
1499 BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
1501 WNDCLASSEX16 wcex;
1502 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
1504 if (ret)
1506 wc->style = wcex.style;
1507 wc->lpfnWndProc = wcex.lpfnWndProc;
1508 wc->cbClsExtra = wcex.cbClsExtra;
1509 wc->cbWndExtra = wcex.cbWndExtra;
1510 wc->hInstance = wcex.hInstance;
1511 wc->hIcon = wcex.hIcon;
1512 wc->hCursor = wcex.hCursor;
1513 wc->hbrBackground = wcex.hbrBackground;
1514 wc->lpszMenuName = wcex.lpszMenuName;
1515 wc->lpszClassName = wcex.lpszClassName;
1517 return ret;
1521 /**************************************************************************
1522 * TrackPopupMenu (USER.416)
1524 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1525 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1527 RECT r;
1528 if (lpRect)
1530 r.left = lpRect->left;
1531 r.top = lpRect->top;
1532 r.right = lpRect->right;
1533 r.bottom = lpRect->bottom;
1535 return TrackPopupMenu( HMENU_32(hMenu), wFlags, x, y, nReserved,
1536 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1540 /**************************************************************************
1541 * FindWindowEx (USER.427)
1543 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1545 return HWND_16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1546 className, title ));
1550 /***********************************************************************
1551 * DefFrameProc (USER.445)
1553 LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient,
1554 UINT16 message, WPARAM16 wParam, LPARAM lParam )
1556 switch (message)
1558 case WM_SETTEXT:
1559 lParam = (LPARAM)MapSL(lParam);
1560 /* fall through */
1561 case WM_COMMAND:
1562 case WM_NCACTIVATE:
1563 case WM_SETFOCUS:
1564 case WM_SIZE:
1565 return DefFrameProcA( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1566 message, wParam, lParam );
1568 case WM_NEXTMENU:
1570 MDINEXTMENU next_menu;
1571 DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1572 message, wParam, (LPARAM)&next_menu );
1573 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1575 default:
1576 return DefWindowProc16(hwnd, message, wParam, lParam);
1581 /***********************************************************************
1582 * DefMDIChildProc (USER.447)
1584 LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
1585 WPARAM16 wParam, LPARAM lParam )
1587 switch (message)
1589 case WM_SETTEXT:
1590 return DefMDIChildProcA( WIN_Handle32(hwnd), message, wParam, (LPARAM)MapSL(lParam) );
1592 case WM_MENUCHAR:
1593 case WM_CLOSE:
1594 case WM_SETFOCUS:
1595 case WM_CHILDACTIVATE:
1596 case WM_SYSCOMMAND:
1597 case WM_SETVISIBLE:
1598 case WM_SIZE:
1599 case WM_SYSCHAR:
1600 return DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, lParam );
1602 case WM_GETMINMAXINFO:
1604 MINMAXINFO16 *mmi16 = MapSL(lParam);
1605 MINMAXINFO mmi;
1607 mmi.ptReserved.x = mmi16->ptReserved.x;
1608 mmi.ptReserved.y = mmi16->ptReserved.y;
1609 mmi.ptMaxSize.x = mmi16->ptMaxSize.x;
1610 mmi.ptMaxSize.y = mmi16->ptMaxSize.y;
1611 mmi.ptMaxPosition.x = mmi16->ptMaxPosition.x;
1612 mmi.ptMaxPosition.y = mmi16->ptMaxPosition.y;
1613 mmi.ptMinTrackSize.x = mmi16->ptMinTrackSize.x;
1614 mmi.ptMinTrackSize.y = mmi16->ptMinTrackSize.y;
1615 mmi.ptMaxTrackSize.x = mmi16->ptMaxTrackSize.x;
1616 mmi.ptMaxTrackSize.y = mmi16->ptMaxTrackSize.y;
1618 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&mmi );
1620 mmi16->ptReserved.x = mmi.ptReserved.x;
1621 mmi16->ptReserved.y = mmi.ptReserved.y;
1622 mmi16->ptMaxSize.x = mmi.ptMaxSize.x;
1623 mmi16->ptMaxSize.y = mmi.ptMaxSize.y;
1624 mmi16->ptMaxPosition.x = mmi.ptMaxPosition.x;
1625 mmi16->ptMaxPosition.y = mmi.ptMaxPosition.y;
1626 mmi16->ptMinTrackSize.x = mmi.ptMinTrackSize.x;
1627 mmi16->ptMinTrackSize.y = mmi.ptMinTrackSize.y;
1628 mmi16->ptMaxTrackSize.x = mmi.ptMaxTrackSize.x;
1629 mmi16->ptMaxTrackSize.y = mmi.ptMaxTrackSize.y;
1630 return 0;
1632 case WM_NEXTMENU:
1634 MDINEXTMENU next_menu;
1635 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
1636 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1638 default:
1639 return DefWindowProc16(hwnd, message, wParam, lParam);
1644 /**************************************************************************
1645 * DrawAnimatedRects (USER.448)
1647 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1648 const RECT16* lprcFrom, const RECT16* lprcTo )
1650 RECT rcFrom32, rcTo32;
1651 rcFrom32.left = lprcFrom->left;
1652 rcFrom32.top = lprcFrom->top;
1653 rcFrom32.right = lprcFrom->right;
1654 rcFrom32.bottom = lprcFrom->bottom;
1655 rcTo32.left = lprcTo->left;
1656 rcTo32.top = lprcTo->top;
1657 rcTo32.right = lprcTo->right;
1658 rcTo32.bottom = lprcTo->bottom;
1659 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1663 /***********************************************************************
1664 * GetInternalWindowPos (USER.460)
1666 UINT16 WINAPI GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd, LPPOINT16 ptIcon )
1668 WINDOWPLACEMENT16 wndpl;
1670 if (!GetWindowPlacement16( hwnd, &wndpl )) return 0;
1671 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1672 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1673 return wndpl.showCmd;
1677 /**************************************************************************
1678 * SetInternalWindowPos (USER.461)
1680 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1682 RECT rc32;
1683 POINT pt32;
1685 if (rect)
1687 rc32.left = rect->left;
1688 rc32.top = rect->top;
1689 rc32.right = rect->right;
1690 rc32.bottom = rect->bottom;
1692 if (pt)
1694 pt32.x = pt->x;
1695 pt32.y = pt->y;
1697 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1698 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1702 /**************************************************************************
1703 * CalcChildScroll (USER.462)
1705 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1707 CalcChildScroll( WIN_Handle32(hwnd), scroll );
1711 /**************************************************************************
1712 * ScrollChildren (USER.463)
1714 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1716 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1720 /**************************************************************************
1721 * DragDetect (USER.465)
1723 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1725 POINT pt32;
1727 pt32.x = pt.x;
1728 pt32.y = pt.y;
1729 return DragDetect( WIN_Handle32(hwnd), pt32 );
1733 /**************************************************************************
1734 * SetScrollInfo (USER.475)
1736 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1738 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1742 /**************************************************************************
1743 * GetScrollInfo (USER.476)
1745 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1747 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1751 /**************************************************************************
1752 * EnableScrollBar (USER.482)
1754 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1756 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1760 /**************************************************************************
1761 * GetShellWindow (USER.600)
1763 HWND16 WINAPI GetShellWindow16(void)
1765 return HWND_16( GetShellWindow() );
1769 /**************************************************************************
1770 * GetForegroundWindow (USER.608)
1772 HWND16 WINAPI GetForegroundWindow16(void)
1774 return HWND_16( GetForegroundWindow() );
1778 /**************************************************************************
1779 * SetForegroundWindow (USER.609)
1781 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1783 return SetForegroundWindow( WIN_Handle32(hwnd) );
1787 /**************************************************************************
1788 * DrawCaptionTemp (USER.657)
1790 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1791 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1793 RECT rect32;
1795 if (rect)
1797 rect32.left = rect->left;
1798 rect32.top = rect->top;
1799 rect32.right = rect->right;
1800 rect32.bottom = rect->bottom;
1802 return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc),
1803 rect ? &rect32 : NULL, HFONT_32(hFont),
1804 HICON_32(hIcon), str, uFlags & 0x1f );
1808 /**************************************************************************
1809 * DrawCaption (USER.660)
1811 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1813 RECT rect32;
1815 if (rect)
1817 rect32.left = rect->left;
1818 rect32.top = rect->top;
1819 rect32.right = rect->right;
1820 rect32.bottom = rect->bottom;
1822 return DrawCaption(WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, flags);
1826 /**************************************************************************
1827 * GetMenuItemRect (USER.665)
1829 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1830 LPRECT16 rect)
1832 RECT r32;
1833 BOOL res;
1834 if (!rect) return FALSE;
1835 res = GetMenuItemRect( WIN_Handle32(hwnd), HMENU_32(hMenu), uItem, &r32 );
1836 rect->left = r32.left;
1837 rect->top = r32.top;
1838 rect->right = r32.right;
1839 rect->bottom = r32.bottom;
1840 return res;
1844 /**************************************************************************
1845 * SetWindowRgn (USER.668)
1847 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1849 return SetWindowRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), redraw );
1853 /**************************************************************************
1854 * MessageBoxIndirect (USER.827)
1856 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1858 MSGBOXPARAMSA msgbox32;
1860 msgbox32.cbSize = msgbox->cbSize;
1861 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1862 msgbox32.hInstance = HINSTANCE_32(msgbox->hInstance);
1863 msgbox32.lpszText = MapSL(msgbox->lpszText);
1864 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1865 msgbox32.dwStyle = msgbox->dwStyle;
1866 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1867 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1868 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1869 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1870 return MessageBoxIndirectA( &msgbox32 );