2 * 16-bit windowing functions
4 * Copyright 2001 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "wine/winuser16.h"
25 #include "stackframe.h"
27 /* handle --> handle16 conversions */
28 #define HANDLE_16(h32) (LOWORD(h32))
30 static HWND16 hwndSysModal;
32 /* ### start build ### */
33 extern WORD CALLBACK WIN_CallTo16_word_wl(WNDENUMPROC16,WORD,LONG);
34 /* ### stop build ### */
42 /* callback for 16-bit window enumeration functions */
43 static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param )
45 const struct wnd_enum_info *info = (struct wnd_enum_info *)param;
46 return WIN_CallTo16_word_wl( info->proc, HWND_16(hwnd), info->param );
49 /* convert insert after window handle to 32-bit */
50 inline static HWND full_insert_after_hwnd( HWND16 hwnd )
52 HWND ret = WIN_Handle32( hwnd );
53 if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
57 /**************************************************************************
60 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
62 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
66 /**************************************************************************
69 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
71 return KillTimer( WIN_Handle32(hwnd), id );
75 /**************************************************************************
76 * SetCapture (USER.18)
78 HWND16 WINAPI SetCapture16( HWND16 hwnd )
80 return HWND_16( SetCapture( WIN_Handle32(hwnd) ));
84 /**************************************************************************
85 * ReleaseCapture (USER.19)
87 BOOL16 WINAPI ReleaseCapture16(void)
89 return ReleaseCapture();
93 /**************************************************************************
96 HWND16 WINAPI SetFocus16( HWND16 hwnd )
98 return HWND_16( SetFocus( WIN_Handle32(hwnd) ));
102 /**************************************************************************
105 HWND16 WINAPI GetFocus16(void)
107 return HWND_16( GetFocus() );
111 /**************************************************************************
112 * RemoveProp (USER.24)
114 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
116 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd), str ));
120 /**************************************************************************
123 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
125 return HANDLE_16(GetPropA( WIN_Handle32(hwnd), str ));
129 /**************************************************************************
132 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
134 return SetPropA( WIN_Handle32(hwnd), str, handle );
138 /**************************************************************************
139 * ClientToScreen (USER.28)
141 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
143 MapWindowPoints16( hwnd, 0, lppnt, 1 );
147 /**************************************************************************
148 * ScreenToClient (USER.29)
150 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
152 MapWindowPoints16( 0, hwnd, lppnt, 1 );
156 /**************************************************************************
157 * WindowFromPoint (USER.30)
159 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
163 CONV_POINT16TO32( &pt, &pt32 );
164 return HWND_16( WindowFromPoint( pt32 ) );
168 /**************************************************************************
171 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
173 return IsIconic( WIN_Handle32(hwnd) );
177 /**************************************************************************
178 * GetWindowRect (USER.32)
180 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
184 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
185 rect->left = rect32.left;
186 rect->top = rect32.top;
187 rect->right = rect32.right;
188 rect->bottom = rect32.bottom;
192 /**************************************************************************
193 * GetClientRect (USER.33)
195 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
199 GetClientRect( WIN_Handle32(hwnd), &rect32 );
200 rect->left = rect32.left;
201 rect->top = rect32.top;
202 rect->right = rect32.right;
203 rect->bottom = rect32.bottom;
207 /**************************************************************************
208 * EnableWindow (USER.34)
210 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
212 return EnableWindow( WIN_Handle32(hwnd), enable );
216 /**************************************************************************
217 * IsWindowEnabled (USER.35)
219 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
221 return IsWindowEnabled( WIN_Handle32(hwnd) );
225 /**************************************************************************
226 * GetWindowText (USER.36)
228 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
230 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
234 /**************************************************************************
235 * SetWindowText (USER.37)
237 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
239 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
243 /**************************************************************************
244 * GetWindowTextLength (USER.38)
246 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
248 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
252 /***********************************************************************
253 * BeginPaint (USER.39)
255 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
259 BeginPaint( WIN_Handle32(hwnd), &ps );
261 lps->fErase = ps.fErase;
262 lps->rcPaint.top = ps.rcPaint.top;
263 lps->rcPaint.left = ps.rcPaint.left;
264 lps->rcPaint.right = ps.rcPaint.right;
265 lps->rcPaint.bottom = ps.rcPaint.bottom;
266 lps->fRestore = ps.fRestore;
267 lps->fIncUpdate = ps.fIncUpdate;
272 /***********************************************************************
275 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
280 return EndPaint( WIN_Handle32(hwnd), &ps );
284 /**************************************************************************
285 * ShowWindow (USER.42)
287 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
289 return ShowWindow( WIN_Handle32(hwnd), cmd );
293 /**************************************************************************
294 * CloseWindow (USER.43)
296 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
298 return CloseWindow( WIN_Handle32(hwnd) );
302 /**************************************************************************
305 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
307 return OpenIcon( WIN_Handle32(hwnd) );
311 /**************************************************************************
312 * BringWindowToTop (USER.45)
314 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
316 return BringWindowToTop( WIN_Handle32(hwnd) );
320 /**************************************************************************
321 * GetParent (USER.46)
323 HWND16 WINAPI GetParent16( HWND16 hwnd )
325 return HWND_16( GetParent( WIN_Handle32(hwnd) ));
329 /**************************************************************************
332 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
334 CURRENT_STACK16->es = USER_HeapSel;
335 /* don't use WIN_Handle32 here, we don't care about the full handle */
336 return IsWindow( WIN_Handle32(hwnd) );
340 /**************************************************************************
343 BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
345 return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
349 /**************************************************************************
350 * IsWindowVisible (USER.49)
352 BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
354 return IsWindowVisible( WIN_Handle32(hwnd) );
358 /**************************************************************************
359 * FindWindow (USER.50)
361 HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
363 return HWND_16( FindWindowA( className, title ));
367 /**************************************************************************
368 * DestroyWindow (USER.53)
370 BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
372 return DestroyWindow( WIN_Handle32(hwnd) );
376 /*******************************************************************
377 * EnumWindows (USER.54)
379 BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
381 struct wnd_enum_info info;
385 return EnumWindows( wnd_enum_callback, (LPARAM)&info );
389 /**********************************************************************
390 * EnumChildWindows (USER.55)
392 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
394 struct wnd_enum_info info;
398 return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info );
402 /**************************************************************************
403 * MoveWindow (USER.56)
405 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
407 return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
411 /**************************************************************************
412 * GetClassName (USER.58)
414 INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
416 return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
420 /**************************************************************************
421 * SetActiveWindow (USER.59)
423 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
425 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd) ));
429 /**************************************************************************
430 * GetActiveWindow (USER.60)
432 HWND16 WINAPI GetActiveWindow16(void)
434 return HWND_16( GetActiveWindow() );
438 /**************************************************************************
439 * ScrollWindow (USER.61)
441 void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
442 const RECT16 *clipRect )
444 RECT rect32, clipRect32;
446 if (rect) CONV_RECT16TO32( rect, &rect32 );
447 if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
448 ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
449 clipRect ? &clipRect32 : NULL );
453 /**************************************************************************
454 * SetScrollPos (USER.62)
456 INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
458 return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
462 /**************************************************************************
463 * GetScrollPos (USER.63)
465 INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
467 return GetScrollPos( WIN_Handle32(hwnd), nBar );
471 /**************************************************************************
472 * SetScrollRange (USER.64)
474 void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
476 /* Invalid range -> range is set to (0,0) */
477 if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
478 SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
482 /**************************************************************************
483 * GetScrollRange (USER.65)
485 BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
488 BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
489 if (lpMin) *lpMin = min;
490 if (lpMax) *lpMax = max;
495 /**************************************************************************
498 HDC16 WINAPI GetDC16( HWND16 hwnd )
500 return HDC_16(GetDC( WIN_Handle32(hwnd) ));
504 /**************************************************************************
505 * GetWindowDC (USER.67)
507 HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
509 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
513 /**************************************************************************
514 * ReleaseDC (USER.68)
516 INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
518 return (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) );
522 /**************************************************************************
523 * EndDialog (USER.88)
525 BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
527 return EndDialog( WIN_Handle32(hwnd), retval );
531 /**************************************************************************
532 * GetDlgItem (USER.91)
534 HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
536 return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg), (UINT16) id ));
540 /**************************************************************************
541 * SetDlgItemText (USER.92)
543 void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
545 SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
549 /**************************************************************************
550 * GetDlgItemText (USER.93)
552 INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
554 return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, (LPARAM)str );
558 /**************************************************************************
559 * SetDlgItemInt (USER.94)
561 void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
563 SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id,
564 (UINT)(fSigned ? (INT16) value : (UINT16) value), fSigned );
568 /**************************************************************************
569 * GetDlgItemInt (USER.95)
571 UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
576 if (translated) *translated = FALSE;
577 result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
581 if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
585 if (result > 65535) return 0;
587 if (translated) *translated = TRUE;
588 return (UINT16)result;
592 /**************************************************************************
593 * CheckRadioButton (USER.96)
595 BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
596 UINT16 lastID, UINT16 checkID )
598 return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
602 /**************************************************************************
603 * CheckDlgButton (USER.97)
605 BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
607 SendDlgItemMessage16( hwnd, id, BM_SETCHECK16, check, 0 );
612 /**************************************************************************
613 * IsDlgButtonChecked (USER.98)
615 UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
617 return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
621 /**************************************************************************
622 * DlgDirSelect (USER.99)
624 BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
626 return DlgDirSelectEx16( hwnd, str, 128, id );
630 /**************************************************************************
631 * DlgDirList (USER.100)
633 INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
634 INT16 idStatic, UINT16 attrib )
636 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
637 * be set automatically (this is different in Win32, and
638 * DIALOG_DlgDirList sends Win32 messages to the control,
640 if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
641 return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
645 /**************************************************************************
646 * SendDlgItemMessage (USER.101)
648 LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
649 WPARAM16 wParam, LPARAM lParam )
651 HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
652 if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
657 /**************************************************************************
658 * MapDialogRect (USER.103)
660 void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
663 MapDialogRect( WIN_Handle32(hwnd), &rect32 );
664 rect->left = rect32.left;
665 rect->right = rect32.right;
666 rect->top = rect32.top;
667 rect->bottom = rect32.bottom;
671 /**************************************************************************
672 * FlashWindow (USER.105)
674 BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
676 return FlashWindow( WIN_Handle32(hwnd), bInvert );
680 /**************************************************************************
681 * WindowFromDC (USER.117)
683 HWND16 WINAPI WindowFromDC16( HDC16 hDC )
685 return HWND_16( WindowFromDC( HDC_32(hDC) ) );
689 /**************************************************************************
690 * UpdateWindow (USER.124)
692 void WINAPI UpdateWindow16( HWND16 hwnd )
694 RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
698 /**************************************************************************
699 * InvalidateRect (USER.125)
701 void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
703 RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
707 /**************************************************************************
708 * InvalidateRgn (USER.126)
710 void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
712 RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
716 /**************************************************************************
717 * ValidateRect (USER.127)
719 void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
721 RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
725 /**************************************************************************
726 * ValidateRgn (USER.128)
728 void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
730 RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
734 /**************************************************************************
735 * GetClassWord (USER.129)
737 WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
739 return GetClassWord( WIN_Handle32(hwnd), offset );
743 /**************************************************************************
744 * SetClassWord (USER.130)
746 WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
748 return SetClassWord( WIN_Handle32(hwnd), offset, newval );
752 /**************************************************************************
753 * GetWindowWord (USER.133)
755 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
757 return GetWindowWord( WIN_Handle32(hwnd), offset );
761 /**************************************************************************
762 * SetWindowWord (USER.134)
764 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
766 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
770 /**************************************************************************
771 * OpenClipboard (USER.137)
773 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
775 return OpenClipboard( WIN_Handle32(hwnd) );
779 /**************************************************************************
780 * GetClipboardOwner (USER.140)
782 HWND16 WINAPI GetClipboardOwner16(void)
784 return HWND_16( GetClipboardOwner() );
788 /**************************************************************************
789 * SetClipboardViewer (USER.147)
791 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
793 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd) ));
797 /**************************************************************************
798 * GetClipboardViewer (USER.148)
800 HWND16 WINAPI GetClipboardViewer16(void)
802 return HWND_16( GetClipboardViewer() );
806 /**************************************************************************
807 * ChangeClipboardChain (USER.149)
809 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
811 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
815 /**************************************************************************
816 * GetSystemMenu (USER.156)
818 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
820 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd), revert ));
824 /**************************************************************************
827 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
829 return HMENU_16(GetMenu( WIN_Handle32(hwnd) ));
833 /**************************************************************************
836 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
838 return SetMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
842 /**************************************************************************
843 * DrawMenuBar (USER.160)
845 void WINAPI DrawMenuBar16( HWND16 hwnd )
847 DrawMenuBar( WIN_Handle32(hwnd) );
851 /**************************************************************************
852 * HiliteMenuItem (USER.162)
854 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
856 return HiliteMenuItem( WIN_Handle32(hwnd), HMENU_32(hMenu), id, wHilite );
860 /**************************************************************************
861 * CreateCaret (USER.163)
863 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
865 CreateCaret( WIN_Handle32(hwnd), HBITMAP_32(bitmap), width, height );
869 /*****************************************************************
870 * DestroyCaret (USER.164)
872 void WINAPI DestroyCaret16(void)
878 /*****************************************************************
879 * SetCaretPos (USER.165)
881 void WINAPI SetCaretPos16( INT16 x, INT16 y )
887 /**************************************************************************
888 * HideCaret (USER.166)
890 void WINAPI HideCaret16( HWND16 hwnd )
892 HideCaret( WIN_Handle32(hwnd) );
896 /**************************************************************************
897 * ShowCaret (USER.167)
899 void WINAPI ShowCaret16( HWND16 hwnd )
901 ShowCaret( WIN_Handle32(hwnd) );
905 /*****************************************************************
906 * SetCaretBlinkTime (USER.168)
908 void WINAPI SetCaretBlinkTime16( UINT16 msecs )
910 SetCaretBlinkTime( msecs );
914 /*****************************************************************
915 * GetCaretBlinkTime (USER.169)
917 UINT16 WINAPI GetCaretBlinkTime16(void)
919 return GetCaretBlinkTime();
923 /**************************************************************************
924 * ArrangeIconicWindows (USER.170)
926 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
928 return ArrangeIconicWindows( WIN_Handle32(parent) );
932 /**************************************************************************
933 * SwitchToThisWindow (USER.172)
935 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
937 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
941 /**************************************************************************
942 * KillSystemTimer (USER.182)
944 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
946 return KillSystemTimer( WIN_Handle32(hwnd), id );
950 /*****************************************************************
951 * GetCaretPos (USER.183)
953 void WINAPI GetCaretPos16( LPPOINT16 pt16 )
956 if (GetCaretPos( &pt ))
964 /**************************************************************************
965 * SetSysModalWindow (USER.188)
967 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
969 HWND16 old = hwndSysModal;
975 /**************************************************************************
976 * GetSysModalWindow (USER.189)
978 HWND16 WINAPI GetSysModalWindow16(void)
984 /**************************************************************************
985 * GetUpdateRect (USER.190)
987 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
992 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
993 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
994 CONV_RECT32TO16( &r, rect );
999 /**************************************************************************
1000 * ChildWindowFromPoint (USER.191)
1002 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
1005 CONV_POINT16TO32( &pt, &pt32 );
1006 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
1010 /**************************************************************************
1011 * DlgDirSelectComboBox (USER.194)
1013 BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
1015 return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
1019 /**************************************************************************
1020 * DlgDirListComboBox (USER.195)
1022 INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
1023 INT16 idStatic, UINT16 attrib )
1025 return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
1029 /**********************************************************************
1030 * EnumTaskWindows (USER.225)
1032 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
1034 struct wnd_enum_info info;
1035 DWORD tid = HTASK_32( hTask );
1037 if (!tid) return FALSE;
1039 info.param = lParam;
1040 return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
1044 /**************************************************************************
1045 * GetNextDlgGroupItem (USER.227)
1047 HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
1050 return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg),
1051 WIN_Handle32(hwndCtrl), fPrevious ));
1055 /**************************************************************************
1056 * GetNextDlgTabItem (USER.228)
1058 HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
1061 return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg),
1062 WIN_Handle32(hwndCtrl), fPrevious ));
1066 /**************************************************************************
1067 * GetTopWindow (USER.229)
1069 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
1071 return HWND_16( GetTopWindow( WIN_Handle32(hwnd) ));
1075 /**************************************************************************
1076 * GetNextWindow (USER.230)
1078 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
1080 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
1081 return GetWindow16( hwnd, flag );
1085 /**************************************************************************
1086 * SetWindowPos (USER.232)
1088 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
1089 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
1091 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
1092 x, y, cx, cy, flags );
1096 /**************************************************************************
1097 * SetParent (USER.233)
1099 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
1101 return HWND_16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
1105 /**************************************************************************
1106 * GetCapture (USER.236)
1108 HWND16 WINAPI GetCapture16(void)
1110 return HWND_16( GetCapture() );
1114 /**************************************************************************
1115 * GetUpdateRgn (USER.237)
1117 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
1119 return GetUpdateRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), erase );
1123 /**************************************************************************
1124 * ExcludeUpdateRgn (USER.238)
1126 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
1128 return ExcludeUpdateRgn( HDC_32(hdc), WIN_Handle32(hwnd) );
1132 /**************************************************************************
1133 * GetOpenClipboardWindow (USER.248)
1135 HWND16 WINAPI GetOpenClipboardWindow16(void)
1137 return HWND_16( GetOpenClipboardWindow() );
1141 /**************************************************************************
1142 * BeginDeferWindowPos (USER.259)
1144 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1146 return BeginDeferWindowPos( count );
1150 /**************************************************************************
1151 * DeferWindowPos (USER.260)
1153 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1154 INT16 x, INT16 y, INT16 cx, INT16 cy,
1157 return HDWP_16(DeferWindowPos( HDWP_32(hdwp), WIN_Handle32(hwnd),
1158 full_insert_after_hwnd(hwndAfter), x, y, cx, cy, flags ));
1162 /**************************************************************************
1163 * EndDeferWindowPos (USER.261)
1165 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1167 return EndDeferWindowPos(HDWP_32(hdwp));
1171 /**************************************************************************
1172 * GetWindow (USER.262)
1174 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1176 return HWND_16( GetWindow( WIN_Handle32(hwnd), rel ) );
1180 /**************************************************************************
1181 * ShowOwnedPopups (USER.265)
1183 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1185 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1189 /**************************************************************************
1190 * ShowScrollBar (USER.267)
1192 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1194 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1198 /**************************************************************************
1199 * IsZoomed (USER.272)
1201 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1203 return IsZoomed( WIN_Handle32(hwnd) );
1207 /**************************************************************************
1208 * GetDlgCtrlID (USER.277)
1210 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1212 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1216 /**************************************************************************
1217 * GetDesktopHwnd (USER.278)
1219 * Exactly the same thing as GetDesktopWindow(), but not documented.
1220 * Don't ask me why...
1222 HWND16 WINAPI GetDesktopHwnd16(void)
1224 return GetDesktopWindow16();
1228 /**************************************************************************
1229 * SetSystemMenu (USER.280)
1231 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1233 return SetSystemMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
1237 /**************************************************************************
1238 * GetDesktopWindow (USER.286)
1240 HWND16 WINAPI GetDesktopWindow16(void)
1242 return HWND_16( GetDesktopWindow() );
1246 /**************************************************************************
1247 * GetLastActivePopup (USER.287)
1249 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1251 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1255 /**************************************************************************
1256 * RedrawWindow (USER.290)
1258 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1259 HRGN16 hrgnUpdate, UINT16 flags )
1264 CONV_RECT16TO32( rectUpdate, &r );
1265 return RedrawWindow(WIN_Handle32(hwnd), &r, HRGN_32(hrgnUpdate), flags);
1267 return RedrawWindow(WIN_Handle32(hwnd), NULL, HRGN_32(hrgnUpdate), flags);
1271 /**************************************************************************
1272 * LockWindowUpdate (USER.294)
1274 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1276 return LockWindowUpdate( WIN_Handle32(hwnd) );
1280 /**************************************************************************
1281 * ScrollWindowEx (USER.319)
1283 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1284 const RECT16 *rect, const RECT16 *clipRect,
1285 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1288 RECT rect32, clipRect32, rcUpdate32;
1291 if (rect) CONV_RECT16TO32( rect, &rect32 );
1292 if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 );
1293 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1294 clipRect ? &clipRect32 : NULL, HRGN_32(hrgnUpdate),
1295 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1296 if (rcUpdate) CONV_RECT32TO16( &rcUpdate32, rcUpdate );
1301 /**************************************************************************
1302 * FillWindow (USER.324)
1304 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1308 GetClientRect( WIN_Handle32(hwnd), &rect );
1309 DPtoLP( HDC_32(hdc), (LPPOINT)&rect, 2 );
1310 CONV_RECT32TO16( &rect, &rc16 );
1311 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1315 /**************************************************************************
1316 * PaintRect (USER.325)
1318 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1319 HBRUSH16 hbrush, const RECT16 *rect)
1321 if (hbrush <= CTLCOLOR_STATIC)
1323 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1325 if (!parent) return;
1326 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1327 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1328 (WPARAM)hdc, (LPARAM)hwnd32 );
1330 if (hbrush) FillRect16( hdc, rect, hbrush );
1334 /**************************************************************************
1335 * GetControlBrush (USER.326)
1337 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1340 HWND hwnd32 = WIN_Handle32(hwnd);
1341 HWND parent = GetParent( hwnd32 );
1343 if (!parent) parent = hwnd32;
1344 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1345 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1346 (WPARAM)hdc, (LPARAM)hwnd32 );
1351 /**************************************************************************
1352 * GetDCEx (USER.359)
1354 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1356 return HDC_16(GetDCEx(WIN_Handle32(hwnd), HRGN_32(hrgnClip), flags));
1360 /**************************************************************************
1361 * GetWindowPlacement (USER.370)
1363 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1365 WINDOWPLACEMENT wpl;
1367 wpl.length = sizeof(wpl);
1368 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1369 wp16->length = sizeof(*wp16);
1370 wp16->flags = wpl.flags;
1371 wp16->showCmd = wpl.showCmd;
1372 CONV_POINT32TO16( &wpl.ptMinPosition, &wp16->ptMinPosition );
1373 CONV_POINT32TO16( &wpl.ptMaxPosition, &wp16->ptMaxPosition );
1374 CONV_RECT32TO16( &wpl.rcNormalPosition, &wp16->rcNormalPosition );
1379 /**************************************************************************
1380 * SetWindowPlacement (USER.371)
1382 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1384 WINDOWPLACEMENT wpl;
1386 if (!wp16) return FALSE;
1387 wpl.length = sizeof(wpl);
1388 wpl.flags = wp16->flags;
1389 wpl.showCmd = wp16->showCmd;
1390 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1391 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1392 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1393 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1394 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1395 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1396 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1397 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1398 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1402 /**************************************************************************
1403 * ChildWindowFromPointEx (USER.399)
1405 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1408 CONV_POINT16TO32( &pt, &pt32 );
1409 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1413 /**************************************************************************
1414 * GetPriorityClipboardFormat (USER.402)
1416 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1420 for (i = 0; i < count; i++)
1421 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1426 /**************************************************************************
1427 * TrackPopupMenu (USER.416)
1429 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1430 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1433 if (lpRect) CONV_RECT16TO32( lpRect, &r );
1434 return TrackPopupMenu( HMENU_32(hMenu), wFlags, x, y, nReserved,
1435 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1439 /**************************************************************************
1440 * DlgDirSelectEx (USER.422)
1442 BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
1444 return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
1448 /**************************************************************************
1449 * DlgDirSelectComboBoxEx (USER.423)
1451 BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
1454 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );
1458 /**************************************************************************
1459 * FindWindowEx (USER.427)
1461 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1463 return HWND_16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1464 className, title ));
1468 /**************************************************************************
1469 * DrawAnimatedRects (USER.448)
1471 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1472 const RECT16* lprcFrom, const RECT16* lprcTo )
1474 RECT rcFrom32, rcTo32;
1475 rcFrom32.left = lprcFrom->left;
1476 rcFrom32.top = lprcFrom->top;
1477 rcFrom32.right = lprcFrom->right;
1478 rcFrom32.bottom = lprcFrom->bottom;
1479 rcTo32.left = lprcTo->left;
1480 rcTo32.top = lprcTo->top;
1481 rcTo32.right = lprcTo->right;
1482 rcTo32.bottom = lprcTo->bottom;
1483 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1487 /**************************************************************************
1488 * SetInternalWindowPos (USER.461)
1490 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1497 rc32.left = rect->left;
1498 rc32.top = rect->top;
1499 rc32.right = rect->right;
1500 rc32.bottom = rect->bottom;
1507 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1508 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1512 /**************************************************************************
1513 * CalcChildScroll (USER.462)
1515 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1517 CalcChildScroll( WIN_Handle32(hwnd), scroll );
1521 /**************************************************************************
1522 * ScrollChildren (USER.463)
1524 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1526 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1530 /**************************************************************************
1531 * DragDetect (USER.465)
1533 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1536 CONV_POINT16TO32( &pt, &pt32 );
1537 return DragDetect( WIN_Handle32(hwnd), pt32 );
1541 /**************************************************************************
1542 * SetScrollInfo (USER.475)
1544 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1546 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1550 /**************************************************************************
1551 * GetScrollInfo (USER.476)
1553 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1555 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1559 /**************************************************************************
1560 * EnableScrollBar (USER.482)
1562 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1564 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1568 /**************************************************************************
1569 * GetShellWindow (USER.600)
1571 HWND16 WINAPI GetShellWindow16(void)
1573 return HWND_16( GetShellWindow() );
1577 /**************************************************************************
1578 * GetForegroundWindow (USER.608)
1580 HWND16 WINAPI GetForegroundWindow16(void)
1582 return HWND_16( GetForegroundWindow() );
1586 /**************************************************************************
1587 * SetForegroundWindow (USER.609)
1589 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1591 return SetForegroundWindow( WIN_Handle32(hwnd) );
1595 /**************************************************************************
1596 * DrawCaptionTemp (USER.657)
1598 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1599 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1603 if (rect) CONV_RECT16TO32(rect,&rect32);
1605 return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc),
1606 rect ? &rect32 : NULL, HFONT_32(hFont),
1607 HICON_32(hIcon), str, uFlags & 0x1f );
1611 /**************************************************************************
1612 * DrawCaption (USER.660)
1614 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1618 if (rect) CONV_RECT16TO32( rect, &rect32 );
1620 return DrawCaption(WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, flags);
1624 /**************************************************************************
1625 * GetMenuItemRect (USER.665)
1627 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1632 if (!rect) return FALSE;
1633 res = GetMenuItemRect( WIN_Handle32(hwnd), HMENU_32(hMenu), uItem, &r32 );
1634 CONV_RECT32TO16( &r32, rect );
1639 /**************************************************************************
1640 * SetWindowRgn (USER.668)
1642 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1644 return SetWindowRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), redraw );
1648 /**************************************************************************
1649 * MessageBoxIndirect (USER.827)
1651 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1653 MSGBOXPARAMSA msgbox32;
1655 msgbox32.cbSize = msgbox->cbSize;
1656 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1657 msgbox32.hInstance = MapHModuleSL(msgbox->hInstance);
1658 msgbox32.lpszText = MapSL(msgbox->lpszText);
1659 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1660 msgbox32.dwStyle = msgbox->dwStyle;
1661 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1662 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1663 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1664 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1665 return MessageBoxIndirectA( &msgbox32 );