2 * 16-bit windowing functions
4 * Copyright 2001 Alexandre Julliard
7 #include "wine/winuser16.h"
11 #include "stackframe.h"
13 static HWND16 hwndSysModal;
15 /* ### start build ### */
16 extern WORD CALLBACK WIN_CallTo16_word_wl(WNDENUMPROC16,WORD,LONG);
17 /* ### stop build ### */
25 /* callback for 16-bit window enumeration functions */
26 static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param )
28 const struct wnd_enum_info *info = (struct wnd_enum_info *)param;
29 return WIN_CallTo16_word_wl( info->proc, hwnd, info->param );
32 /* convert insert after window handle to 32-bit */
33 inline static HWND full_insert_after_hwnd( HWND16 hwnd )
35 HWND ret = WIN_Handle32( hwnd );
36 if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
40 /**************************************************************************
43 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
45 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
49 /**************************************************************************
52 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
54 return KillTimer( WIN_Handle32(hwnd), id );
58 /**************************************************************************
59 * SetCapture (USER.18)
61 HWND16 WINAPI SetCapture16( HWND16 hwnd )
63 return WIN_Handle16( SetCapture( WIN_Handle32(hwnd) ));
67 /**************************************************************************
68 * ReleaseCapture (USER.19)
70 BOOL16 WINAPI ReleaseCapture16(void)
72 return ReleaseCapture();
76 /**************************************************************************
79 HWND16 WINAPI SetFocus16( HWND16 hwnd )
81 return WIN_Handle16( SetFocus( WIN_Handle32(hwnd) ));
85 /**************************************************************************
88 HWND16 WINAPI GetFocus16(void)
90 return WIN_Handle16( GetFocus() );
94 /**************************************************************************
95 * RemoveProp (USER.24)
97 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
99 return (HANDLE16)RemovePropA( WIN_Handle32(hwnd), str );
103 /**************************************************************************
106 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
108 return (HANDLE16)GetPropA( WIN_Handle32(hwnd), str );
112 /**************************************************************************
115 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
117 return SetPropA( WIN_Handle32(hwnd), str, handle );
121 /**************************************************************************
122 * ClientToScreen (USER.28)
124 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
126 MapWindowPoints16( hwnd, 0, lppnt, 1 );
130 /**************************************************************************
131 * ScreenToClient (USER.29)
133 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
135 MapWindowPoints16( 0, hwnd, lppnt, 1 );
139 /**************************************************************************
140 * WindowFromPoint (USER.30)
142 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
146 CONV_POINT16TO32( &pt, &pt32 );
147 return WIN_Handle16( WindowFromPoint( pt32 ) );
151 /**************************************************************************
154 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
156 return IsIconic( WIN_Handle32(hwnd) );
160 /**************************************************************************
161 * GetWindowRect (USER.32)
163 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
167 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
168 rect->left = rect32.left;
169 rect->top = rect32.top;
170 rect->right = rect32.right;
171 rect->bottom = rect32.bottom;
175 /**************************************************************************
176 * GetClientRect (USER.33)
178 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
182 GetClientRect( WIN_Handle32(hwnd), &rect32 );
183 rect->left = rect32.left;
184 rect->top = rect32.top;
185 rect->right = rect32.right;
186 rect->bottom = rect32.bottom;
190 /**************************************************************************
191 * EnableWindow (USER.34)
193 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
195 return EnableWindow( WIN_Handle32(hwnd), enable );
199 /**************************************************************************
200 * IsWindowEnabled (USER.35)
202 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
204 return IsWindowEnabled( WIN_Handle32(hwnd) );
208 /**************************************************************************
209 * GetWindowText (USER.36)
211 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
213 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
217 /**************************************************************************
218 * SetWindowText (USER.37)
220 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
222 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
226 /**************************************************************************
227 * GetWindowTextLength (USER.38)
229 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
231 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
235 /***********************************************************************
236 * BeginPaint (USER.39)
238 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
242 BeginPaint( WIN_Handle32(hwnd), &ps );
244 lps->fErase = ps.fErase;
245 lps->rcPaint.top = ps.rcPaint.top;
246 lps->rcPaint.left = ps.rcPaint.left;
247 lps->rcPaint.right = ps.rcPaint.right;
248 lps->rcPaint.bottom = ps.rcPaint.bottom;
249 lps->fRestore = ps.fRestore;
250 lps->fIncUpdate = ps.fIncUpdate;
255 /***********************************************************************
258 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
263 return EndPaint( WIN_Handle32(hwnd), &ps );
267 /**************************************************************************
268 * ShowWindow (USER.42)
270 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
272 return ShowWindow( WIN_Handle32(hwnd), cmd );
276 /**************************************************************************
277 * CloseWindow (USER.43)
279 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
281 return CloseWindow( WIN_Handle32(hwnd) );
285 /**************************************************************************
288 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
290 return OpenIcon( WIN_Handle32(hwnd) );
294 /**************************************************************************
295 * BringWindowToTop (USER.45)
297 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
299 return BringWindowToTop( WIN_Handle32(hwnd) );
303 /**************************************************************************
304 * GetParent (USER.46)
306 HWND16 WINAPI GetParent16( HWND16 hwnd )
308 return WIN_Handle16( GetParent( WIN_Handle32(hwnd) ));
312 /**************************************************************************
315 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
317 CURRENT_STACK16->es = USER_HeapSel;
318 /* don't use WIN_Handle32 here, we don't care about the full handle */
319 return IsWindow( (HWND)(ULONG_PTR)hwnd );
323 /**************************************************************************
326 BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
328 return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
332 /**************************************************************************
333 * IsWindowVisible (USER.49)
335 BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
337 return IsWindowVisible( WIN_Handle32(hwnd) );
341 /**************************************************************************
342 * FindWindow (USER.50)
344 HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
346 return WIN_Handle16( FindWindowA( className, title ));
350 /**************************************************************************
351 * DestroyWindow (USER.53)
353 BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
355 return DestroyWindow( WIN_Handle32(hwnd) );
359 /*******************************************************************
360 * EnumWindows (USER.54)
362 BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
364 struct wnd_enum_info info;
368 return EnumWindows( wnd_enum_callback, (LPARAM)&info );
372 /**********************************************************************
373 * EnumChildWindows (USER.55)
375 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
377 struct wnd_enum_info info;
381 return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info );
385 /**************************************************************************
386 * MoveWindow (USER.56)
388 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
390 return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
394 /**************************************************************************
395 * GetClassName (USER.58)
397 INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
399 return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
403 /**************************************************************************
404 * SetActiveWindow (USER.59)
406 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
408 return WIN_Handle16( SetActiveWindow( WIN_Handle32(hwnd) ));
412 /**************************************************************************
413 * GetActiveWindow (USER.60)
415 HWND16 WINAPI GetActiveWindow16(void)
417 return WIN_Handle16( GetActiveWindow() );
421 /**************************************************************************
422 * ScrollWindow (USER.61)
424 void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
425 const RECT16 *clipRect )
427 RECT rect32, clipRect32;
429 if (rect) CONV_RECT16TO32( rect, &rect32 );
430 if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
431 ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
432 clipRect ? &clipRect32 : NULL );
436 /**************************************************************************
437 * SetScrollPos (USER.62)
439 INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
441 return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
445 /**************************************************************************
446 * GetScrollPos (USER.63)
448 INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
450 return GetScrollPos( WIN_Handle32(hwnd), nBar );
454 /**************************************************************************
455 * SetScrollRange (USER.64)
457 void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
459 /* Invalid range -> range is set to (0,0) */
460 if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
461 SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
465 /**************************************************************************
466 * GetScrollRange (USER.65)
468 BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
471 BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
472 if (lpMin) *lpMin = min;
473 if (lpMax) *lpMax = max;
478 /**************************************************************************
481 HDC16 WINAPI GetDC16( HWND16 hwnd )
483 return (HDC16)GetDC( WIN_Handle32(hwnd) );
487 /**************************************************************************
488 * GetWindowDC (USER.67)
490 HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
492 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
496 /**************************************************************************
497 * ReleaseDC (USER.68)
499 INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
501 return (INT16)ReleaseDC( WIN_Handle32(hwnd), hdc );
505 /**************************************************************************
506 * EndDialog (USER.88)
508 BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
510 return EndDialog( WIN_Handle32(hwnd), retval );
514 /**************************************************************************
515 * GetDlgItem (USER.91)
517 HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
519 return WIN_Handle16( GetDlgItem( WIN_Handle32(hwndDlg), (UINT16) id ));
523 /**************************************************************************
524 * SetDlgItemText (USER.92)
526 void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
528 SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
532 /**************************************************************************
533 * GetDlgItemText (USER.93)
535 INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
537 return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, (LPARAM)str );
541 /**************************************************************************
542 * SetDlgItemInt (USER.94)
544 void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
546 SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id,
547 (UINT)(fSigned ? (INT16) value : (UINT16) value), fSigned );
551 /**************************************************************************
552 * GetDlgItemInt (USER.95)
554 UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
559 if (translated) *translated = FALSE;
560 result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
564 if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
568 if (result > 65535) return 0;
570 if (translated) *translated = TRUE;
571 return (UINT16)result;
575 /**************************************************************************
576 * CheckRadioButton (USER.96)
578 BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
579 UINT16 lastID, UINT16 checkID )
581 return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
585 /**************************************************************************
586 * CheckDlgButton (USER.97)
588 BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
590 SendDlgItemMessage16( hwnd, id, BM_SETCHECK16, check, 0 );
595 /**************************************************************************
596 * IsDlgButtonChecked (USER.98)
598 UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
600 return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
604 /**************************************************************************
605 * DlgDirSelect (USER.99)
607 BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
609 return DlgDirSelectEx16( hwnd, str, 128, id );
613 /**************************************************************************
614 * DlgDirList (USER.100)
616 INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
617 INT16 idStatic, UINT16 attrib )
619 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
620 * be set automatically (this is different in Win32, and
621 * DIALOG_DlgDirList sends Win32 messages to the control,
623 if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
624 return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
628 /**************************************************************************
629 * SendDlgItemMessage (USER.101)
631 LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
632 WPARAM16 wParam, LPARAM lParam )
634 HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
635 if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
640 /**************************************************************************
641 * MapDialogRect (USER.103)
643 void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
646 MapDialogRect( WIN_Handle32(hwnd), &rect32 );
647 rect->left = rect32.left;
648 rect->right = rect32.right;
649 rect->top = rect32.top;
650 rect->bottom = rect32.bottom;
654 /**************************************************************************
655 * FlashWindow (USER.105)
657 BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
659 return FlashWindow( WIN_Handle32(hwnd), bInvert );
663 /**************************************************************************
664 * WindowFromDC (USER.117)
666 HWND16 WINAPI WindowFromDC16( HDC16 hDC )
668 return WIN_Handle16( WindowFromDC( hDC ) );
672 /**************************************************************************
673 * UpdateWindow (USER.124)
675 void WINAPI UpdateWindow16( HWND16 hwnd )
677 RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
681 /**************************************************************************
682 * InvalidateRect (USER.125)
684 void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
686 RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
690 /**************************************************************************
691 * InvalidateRgn (USER.126)
693 void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
695 RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
699 /**************************************************************************
700 * ValidateRect (USER.127)
702 void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
704 RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
708 /**************************************************************************
709 * ValidateRgn (USER.128)
711 void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
713 RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
717 /**************************************************************************
718 * GetClassWord (USER.129)
720 WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
722 return GetClassWord( WIN_Handle32(hwnd), offset );
726 /**************************************************************************
727 * SetClassWord (USER.130)
729 WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
731 return SetClassWord( WIN_Handle32(hwnd), offset, newval );
735 /**************************************************************************
736 * GetWindowWord (USER.133)
738 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
740 return GetWindowWord( WIN_Handle32(hwnd), offset );
744 /**************************************************************************
745 * SetWindowWord (USER.134)
747 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
749 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
753 /**************************************************************************
754 * OpenClipboard (USER.137)
756 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
758 return OpenClipboard( WIN_Handle32(hwnd) );
762 /**************************************************************************
763 * GetClipboardOwner (USER.140)
765 HWND16 WINAPI GetClipboardOwner16(void)
767 return WIN_Handle16( GetClipboardOwner() );
771 /**************************************************************************
772 * SetClipboardViewer (USER.147)
774 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
776 return WIN_Handle16( SetClipboardViewer( WIN_Handle32(hwnd) ));
780 /**************************************************************************
781 * GetClipboardViewer (USER.148)
783 HWND16 WINAPI GetClipboardViewer16(void)
785 return WIN_Handle16( GetClipboardViewer() );
789 /**************************************************************************
790 * ChangeClipboardChain (USER.149)
792 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
794 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
798 /**************************************************************************
799 * GetSystemMenu (USER.156)
801 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
803 return GetSystemMenu( WIN_Handle32(hwnd), revert );
807 /**************************************************************************
810 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
812 return GetMenu( WIN_Handle32(hwnd) );
816 /**************************************************************************
819 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
821 return SetMenu( WIN_Handle32(hwnd), hMenu );
825 /**************************************************************************
826 * DrawMenuBar (USER.160)
828 void WINAPI DrawMenuBar16( HWND16 hwnd )
830 DrawMenuBar( WIN_Handle32(hwnd) );
834 /**************************************************************************
835 * HiliteMenuItem (USER.162)
837 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
839 return HiliteMenuItem( WIN_Handle32(hwnd), hMenu, id, wHilite );
843 /**************************************************************************
844 * CreateCaret (USER.163)
846 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
848 CreateCaret( WIN_Handle32(hwnd), bitmap, width, height );
852 /**************************************************************************
853 * HideCaret (USER.166)
855 void WINAPI HideCaret16( HWND16 hwnd )
857 HideCaret( WIN_Handle32(hwnd) );
861 /**************************************************************************
862 * ShowCaret (USER.167)
864 void WINAPI ShowCaret16( HWND16 hwnd )
866 ShowCaret( WIN_Handle32(hwnd) );
870 /**************************************************************************
871 * ArrangeIconicWindows (USER.170)
873 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
875 return ArrangeIconicWindows( WIN_Handle32(parent) );
879 /**************************************************************************
880 * SwitchToThisWindow (USER.172)
882 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
884 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
888 /**************************************************************************
889 * KillSystemTimer (USER.182)
891 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
893 return KillSystemTimer( WIN_Handle32(hwnd), id );
897 /**************************************************************************
898 * SetSysModalWindow (USER.188)
900 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
902 HWND16 old = hwndSysModal;
908 /**************************************************************************
909 * GetSysModalWindow (USER.189)
911 HWND16 WINAPI GetSysModalWindow16(void)
917 /**************************************************************************
918 * GetUpdateRect (USER.190)
920 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
925 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
926 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
927 CONV_RECT32TO16( &r, rect );
932 /**************************************************************************
933 * ChildWindowFromPoint (USER.191)
935 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
938 CONV_POINT16TO32( &pt, &pt32 );
939 return WIN_Handle16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
943 /**************************************************************************
944 * DlgDirSelectComboBox (USER.194)
946 BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
948 return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
952 /**************************************************************************
953 * DlgDirListComboBox (USER.195)
955 INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
956 INT16 idStatic, UINT16 attrib )
958 return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
962 /**********************************************************************
963 * EnumTaskWindows (USER.225)
965 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
967 struct wnd_enum_info info;
968 TDB *tdb = TASK_GetPtr( hTask );
970 if (!tdb) return FALSE;
973 return EnumThreadWindows( (DWORD)tdb->teb->tid, wnd_enum_callback, (LPARAM)&info );
977 /**************************************************************************
978 * GetNextDlgGroupItem (USER.227)
980 HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
983 return WIN_Handle16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg),
984 WIN_Handle32(hwndCtrl), fPrevious ));
988 /**************************************************************************
989 * GetNextDlgTabItem (USER.228)
991 HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
994 return WIN_Handle16( GetNextDlgTabItem( WIN_Handle32(hwndDlg),
995 WIN_Handle32(hwndCtrl), fPrevious ));
999 /**************************************************************************
1000 * GetTopWindow (USER.229)
1002 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
1004 return WIN_Handle16( GetTopWindow( WIN_Handle32(hwnd) ));
1008 /**************************************************************************
1009 * GetNextWindow (USER.230)
1011 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
1013 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
1014 return GetWindow16( hwnd, flag );
1018 /**************************************************************************
1019 * SetWindowPos (USER.232)
1021 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
1022 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
1024 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
1025 x, y, cx, cy, flags );
1029 /**************************************************************************
1030 * SetParent (USER.233)
1032 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
1034 return WIN_Handle16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
1038 /**************************************************************************
1039 * GetCapture (USER.236)
1041 HWND16 WINAPI GetCapture16(void)
1043 return WIN_Handle16( GetCapture() );
1047 /**************************************************************************
1048 * GetUpdateRgn (USER.237)
1050 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
1052 return GetUpdateRgn( WIN_Handle32(hwnd), hrgn, erase );
1056 /**************************************************************************
1057 * ExcludeUpdateRgn (USER.238)
1059 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
1061 return ExcludeUpdateRgn( hdc, WIN_Handle32(hwnd) );
1065 /**************************************************************************
1066 * GetOpenClipboardWindow (USER.248)
1068 HWND16 WINAPI GetOpenClipboardWindow16(void)
1070 return WIN_Handle16( GetOpenClipboardWindow() );
1074 /**************************************************************************
1075 * BeginDeferWindowPos (USER.259)
1077 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1079 return BeginDeferWindowPos( count );
1083 /**************************************************************************
1084 * DeferWindowPos (USER.260)
1086 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1087 INT16 x, INT16 y, INT16 cx, INT16 cy,
1090 return DeferWindowPos( hdwp, WIN_Handle32(hwnd), full_insert_after_hwnd(hwndAfter),
1091 x, y, cx, cy, flags );
1095 /**************************************************************************
1096 * EndDeferWindowPos (USER.261)
1098 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1100 return EndDeferWindowPos( hdwp );
1104 /**************************************************************************
1105 * GetWindow (USER.262)
1107 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1109 return WIN_Handle16( GetWindow( WIN_Handle32(hwnd), rel ) );
1113 /**************************************************************************
1114 * ShowOwnedPopups (USER.265)
1116 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1118 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1122 /**************************************************************************
1123 * ShowScrollBar (USER.267)
1125 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1127 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1131 /**************************************************************************
1132 * IsZoomed (USER.272)
1134 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1136 return IsZoomed( WIN_Handle32(hwnd) );
1140 /**************************************************************************
1141 * GetDlgCtrlID (USER.277)
1143 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1145 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1149 /**************************************************************************
1150 * GetDesktopHwnd (USER.278)
1152 * Exactly the same thing as GetDesktopWindow(), but not documented.
1153 * Don't ask me why...
1155 HWND16 WINAPI GetDesktopHwnd16(void)
1157 return GetDesktopWindow16();
1161 /**************************************************************************
1162 * SetSystemMenu (USER.280)
1164 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1166 return SetSystemMenu( WIN_Handle32(hwnd), hMenu );
1170 /**************************************************************************
1171 * GetDesktopWindow (USER.286)
1173 HWND16 WINAPI GetDesktopWindow16(void)
1175 return WIN_Handle16( GetDesktopWindow() );
1179 /**************************************************************************
1180 * GetLastActivePopup (USER.287)
1182 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1184 return WIN_Handle16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1188 /**************************************************************************
1189 * RedrawWindow (USER.290)
1191 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1192 HRGN16 hrgnUpdate, UINT16 flags )
1197 CONV_RECT16TO32( rectUpdate, &r );
1198 return RedrawWindow( WIN_Handle32(hwnd), &r, hrgnUpdate, flags );
1200 return RedrawWindow( WIN_Handle32(hwnd), NULL, hrgnUpdate, flags );
1204 /**************************************************************************
1205 * LockWindowUpdate (USER.294)
1207 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1209 return LockWindowUpdate( WIN_Handle32(hwnd) );
1213 /**************************************************************************
1214 * ScrollWindowEx (USER.319)
1216 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1217 const RECT16 *rect, const RECT16 *clipRect,
1218 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1221 RECT rect32, clipRect32, rcUpdate32;
1224 if (rect) CONV_RECT16TO32( rect, &rect32 );
1225 if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
1226 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1227 clipRect ? &clipRect32 : NULL, hrgnUpdate,
1228 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1229 if (rcUpdate) CONV_RECT32TO16( &rcUpdate32, rcUpdate );
1234 /**************************************************************************
1235 * FillWindow (USER.324)
1237 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1241 GetClientRect( WIN_Handle32(hwnd), &rect );
1242 DPtoLP( hdc, (LPPOINT)&rect, 2 );
1243 CONV_RECT32TO16( &rect, &rc16 );
1244 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1248 /**************************************************************************
1249 * PaintRect (USER.325)
1251 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1252 HBRUSH16 hbrush, const RECT16 *rect)
1254 if (hbrush <= CTLCOLOR_STATIC)
1256 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1258 if (!parent) return;
1259 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1260 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1261 (WPARAM)hdc, (LPARAM)hwnd32 );
1263 if (hbrush) FillRect16( hdc, rect, hbrush );
1267 /**************************************************************************
1268 * GetControlBrush (USER.326)
1270 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1273 HWND hwnd32 = WIN_Handle32(hwnd);
1274 HWND parent = GetParent( hwnd32 );
1276 if (!parent) parent = hwnd32;
1277 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1278 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1279 (WPARAM)hdc, (LPARAM)hwnd32 );
1284 /**************************************************************************
1285 * GetDCEx (USER.359)
1287 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1289 return (HDC16)GetDCEx( WIN_Handle32(hwnd), hrgnClip, flags );
1293 /**************************************************************************
1294 * GetWindowPlacement (USER.370)
1296 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1298 WINDOWPLACEMENT wpl;
1300 wpl.length = sizeof(wpl);
1301 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1302 wp16->length = sizeof(*wp16);
1303 wp16->flags = wpl.flags;
1304 wp16->showCmd = wpl.showCmd;
1305 CONV_POINT32TO16( &wpl.ptMinPosition, &wp16->ptMinPosition );
1306 CONV_POINT32TO16( &wpl.ptMaxPosition, &wp16->ptMaxPosition );
1307 CONV_RECT32TO16( &wpl.rcNormalPosition, &wp16->rcNormalPosition );
1312 /**************************************************************************
1313 * SetWindowPlacement (USER.371)
1315 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1317 WINDOWPLACEMENT wpl;
1319 if (!wp16) return FALSE;
1320 wpl.length = sizeof(wpl);
1321 wpl.flags = wp16->flags;
1322 wpl.showCmd = wp16->showCmd;
1323 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1324 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1325 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1326 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1327 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1328 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1329 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1330 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1331 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1335 /**************************************************************************
1336 * ChildWindowFromPointEx (USER.399)
1338 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1341 CONV_POINT16TO32( &pt, &pt32 );
1342 return WIN_Handle16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1346 /**************************************************************************
1347 * GetPriorityClipboardFormat (USER.402)
1349 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1353 for (i = 0; i < count; i++)
1354 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1359 /**************************************************************************
1360 * TrackPopupMenu (USER.416)
1362 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1363 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1366 if (lpRect) CONV_RECT16TO32( lpRect, &r );
1367 return TrackPopupMenu( hMenu, wFlags, x, y, nReserved,
1368 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1372 /**************************************************************************
1373 * DlgDirSelectEx (USER.422)
1375 BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
1377 return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
1381 /**************************************************************************
1382 * DlgDirSelectComboBoxEx (USER.423)
1384 BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
1387 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );
1391 /**************************************************************************
1392 * FindWindowEx (USER.427)
1394 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1396 return WIN_Handle16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1397 className, title ));
1401 /**************************************************************************
1402 * DrawAnimatedRects (USER.448)
1404 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1405 const RECT16* lprcFrom, const RECT16* lprcTo )
1407 RECT rcFrom32, rcTo32;
1408 rcFrom32.left = lprcFrom->left;
1409 rcFrom32.top = lprcFrom->top;
1410 rcFrom32.right = lprcFrom->right;
1411 rcFrom32.bottom = lprcFrom->bottom;
1412 rcTo32.left = lprcTo->left;
1413 rcTo32.top = lprcTo->top;
1414 rcTo32.right = lprcTo->right;
1415 rcTo32.bottom = lprcTo->bottom;
1416 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1420 /**************************************************************************
1421 * SetInternalWindowPos (USER.461)
1423 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1430 rc32.left = rect->left;
1431 rc32.top = rect->top;
1432 rc32.right = rect->right;
1433 rc32.bottom = rect->bottom;
1440 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1441 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1445 /**************************************************************************
1446 * CalcChildScroll (USER.462)
1448 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1450 return CalcChildScroll( WIN_Handle32(hwnd), scroll );
1454 /**************************************************************************
1455 * ScrollChildren (USER.463)
1457 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1459 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1463 /**************************************************************************
1464 * DragDetect (USER.465)
1466 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1469 CONV_POINT16TO32( &pt, &pt32 );
1470 return DragDetect( WIN_Handle32(hwnd), pt32 );
1474 /**************************************************************************
1475 * SetScrollInfo (USER.475)
1477 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1479 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1483 /**************************************************************************
1484 * GetScrollInfo (USER.476)
1486 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1488 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1492 /**************************************************************************
1493 * EnableScrollBar (USER.482)
1495 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1497 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1501 /**************************************************************************
1502 * GetShellWindow (USER.600)
1504 HWND16 WINAPI GetShellWindow16(void)
1506 return WIN_Handle16( GetShellWindow() );
1510 /**************************************************************************
1511 * GetForegroundWindow (USER.608)
1513 HWND16 WINAPI GetForegroundWindow16(void)
1515 return WIN_Handle16( GetForegroundWindow() );
1519 /**************************************************************************
1520 * SetForegroundWindow (USER.609)
1522 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1524 return SetForegroundWindow( WIN_Handle32(hwnd) );
1528 /**************************************************************************
1529 * DrawCaptionTemp (USER.657)
1531 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1532 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1536 if (rect) CONV_RECT16TO32(rect,&rect32);
1538 return DrawCaptionTempA( WIN_Handle32(hwnd), hdc, rect ? &rect32 : NULL,
1539 hFont, hIcon, str, uFlags & 0x1f );
1543 /**************************************************************************
1544 * DrawCaption (USER.660)
1546 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1550 if (rect) CONV_RECT16TO32( rect, &rect32 );
1552 return DrawCaption( WIN_Handle32(hwnd), hdc, rect ? &rect32 : NULL, flags );
1556 /**************************************************************************
1557 * GetMenuItemRect (USER.665)
1559 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1564 if (!rect) return FALSE;
1565 res = GetMenuItemRect( WIN_Handle32(hwnd), hMenu, uItem, &r32 );
1566 CONV_RECT32TO16( &r32, rect );
1571 /**************************************************************************
1572 * SetWindowRgn (USER.668)
1574 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1576 return SetWindowRgn( WIN_Handle32(hwnd), hrgn, redraw );
1580 /**************************************************************************
1581 * MessageBoxIndirect (USER.827)
1583 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1585 MSGBOXPARAMSA msgbox32;
1587 msgbox32.cbSize = msgbox->cbSize;
1588 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1589 msgbox32.hInstance = msgbox->hInstance;
1590 msgbox32.lpszText = MapSL(msgbox->lpszText);
1591 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1592 msgbox32.dwStyle = msgbox->dwStyle;
1593 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1594 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1595 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1596 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1597 return MessageBoxIndirectA( &msgbox32 );