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))
29 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
31 static HWND16 hwndSysModal
;
39 /* callback for 16-bit window enumeration functions */
40 static BOOL CALLBACK
wnd_enum_callback( HWND hwnd
, LPARAM param
)
42 const struct wnd_enum_info
*info
= (struct wnd_enum_info
*)param
;
46 args
[2] = HWND_16(hwnd
);
47 args
[1] = HIWORD(info
->param
);
48 args
[0] = LOWORD(info
->param
);
49 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
53 /* convert insert after window handle to 32-bit */
54 inline static HWND
full_insert_after_hwnd( HWND16 hwnd
)
56 HWND ret
= WIN_Handle32( hwnd
);
57 if (ret
== (HWND
)0xffff) ret
= HWND_TOPMOST
;
61 /**************************************************************************
64 INT16 WINAPI
MessageBox16( HWND16 hwnd
, LPCSTR text
, LPCSTR title
, UINT16 type
)
66 return MessageBoxA( WIN_Handle32(hwnd
), text
, title
, type
);
70 /**************************************************************************
73 BOOL16 WINAPI
KillTimer16( HWND16 hwnd
, UINT16 id
)
75 return KillTimer( WIN_Handle32(hwnd
), id
);
79 /**************************************************************************
80 * SetCapture (USER.18)
82 HWND16 WINAPI
SetCapture16( HWND16 hwnd
)
84 return HWND_16( SetCapture( WIN_Handle32(hwnd
) ));
88 /**************************************************************************
89 * ReleaseCapture (USER.19)
91 BOOL16 WINAPI
ReleaseCapture16(void)
93 return ReleaseCapture();
97 /**************************************************************************
100 HWND16 WINAPI
SetFocus16( HWND16 hwnd
)
102 return HWND_16( SetFocus( WIN_Handle32(hwnd
) ));
106 /**************************************************************************
109 HWND16 WINAPI
GetFocus16(void)
111 return HWND_16( GetFocus() );
115 /**************************************************************************
116 * RemoveProp (USER.24)
118 HANDLE16 WINAPI
RemoveProp16( HWND16 hwnd
, LPCSTR str
)
120 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd
), str
));
124 /**************************************************************************
127 HANDLE16 WINAPI
GetProp16( HWND16 hwnd
, LPCSTR str
)
129 return HANDLE_16(GetPropA( WIN_Handle32(hwnd
), str
));
133 /**************************************************************************
136 BOOL16 WINAPI
SetProp16( HWND16 hwnd
, LPCSTR str
, HANDLE16 handle
)
138 return SetPropA( WIN_Handle32(hwnd
), str
, HANDLE_32(handle
) );
142 /**************************************************************************
143 * ClientToScreen (USER.28)
145 void WINAPI
ClientToScreen16( HWND16 hwnd
, LPPOINT16 lppnt
)
147 MapWindowPoints16( hwnd
, 0, lppnt
, 1 );
151 /**************************************************************************
152 * ScreenToClient (USER.29)
154 void WINAPI
ScreenToClient16( HWND16 hwnd
, LPPOINT16 lppnt
)
156 MapWindowPoints16( 0, hwnd
, lppnt
, 1 );
160 /**************************************************************************
161 * WindowFromPoint (USER.30)
163 HWND16 WINAPI
WindowFromPoint16( POINT16 pt
)
167 CONV_POINT16TO32( &pt
, &pt32
);
168 return HWND_16( WindowFromPoint( pt32
) );
172 /**************************************************************************
175 BOOL16 WINAPI
IsIconic16(HWND16 hwnd
)
177 return IsIconic( WIN_Handle32(hwnd
) );
181 /**************************************************************************
182 * GetWindowRect (USER.32)
184 void WINAPI
GetWindowRect16( HWND16 hwnd
, LPRECT16 rect
)
188 GetWindowRect( WIN_Handle32(hwnd
), &rect32
);
189 rect
->left
= rect32
.left
;
190 rect
->top
= rect32
.top
;
191 rect
->right
= rect32
.right
;
192 rect
->bottom
= rect32
.bottom
;
196 /**************************************************************************
197 * GetClientRect (USER.33)
199 void WINAPI
GetClientRect16( HWND16 hwnd
, LPRECT16 rect
)
203 GetClientRect( WIN_Handle32(hwnd
), &rect32
);
204 rect
->left
= rect32
.left
;
205 rect
->top
= rect32
.top
;
206 rect
->right
= rect32
.right
;
207 rect
->bottom
= rect32
.bottom
;
211 /**************************************************************************
212 * EnableWindow (USER.34)
214 BOOL16 WINAPI
EnableWindow16( HWND16 hwnd
, BOOL16 enable
)
216 return EnableWindow( WIN_Handle32(hwnd
), enable
);
220 /**************************************************************************
221 * IsWindowEnabled (USER.35)
223 BOOL16 WINAPI
IsWindowEnabled16(HWND16 hwnd
)
225 return IsWindowEnabled( WIN_Handle32(hwnd
) );
229 /**************************************************************************
230 * GetWindowText (USER.36)
232 INT16 WINAPI
GetWindowText16( HWND16 hwnd
, SEGPTR lpString
, INT16 nMaxCount
)
234 return SendMessage16( hwnd
, WM_GETTEXT
, nMaxCount
, lpString
);
238 /**************************************************************************
239 * SetWindowText (USER.37)
241 BOOL16 WINAPI
SetWindowText16( HWND16 hwnd
, SEGPTR lpString
)
243 return SendMessage16( hwnd
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
247 /**************************************************************************
248 * GetWindowTextLength (USER.38)
250 INT16 WINAPI
GetWindowTextLength16( HWND16 hwnd
)
252 return SendMessage16( hwnd
, WM_GETTEXTLENGTH
, 0, 0 );
256 /***********************************************************************
257 * BeginPaint (USER.39)
259 HDC16 WINAPI
BeginPaint16( HWND16 hwnd
, LPPAINTSTRUCT16 lps
)
263 BeginPaint( WIN_Handle32(hwnd
), &ps
);
264 lps
->hdc
= HDC_16(ps
.hdc
);
265 lps
->fErase
= ps
.fErase
;
266 lps
->rcPaint
.top
= ps
.rcPaint
.top
;
267 lps
->rcPaint
.left
= ps
.rcPaint
.left
;
268 lps
->rcPaint
.right
= ps
.rcPaint
.right
;
269 lps
->rcPaint
.bottom
= ps
.rcPaint
.bottom
;
270 lps
->fRestore
= ps
.fRestore
;
271 lps
->fIncUpdate
= ps
.fIncUpdate
;
276 /***********************************************************************
279 BOOL16 WINAPI
EndPaint16( HWND16 hwnd
, const PAINTSTRUCT16
* lps
)
283 ps
.hdc
= HDC_32(lps
->hdc
);
284 return EndPaint( WIN_Handle32(hwnd
), &ps
);
288 /**************************************************************************
289 * ShowWindow (USER.42)
291 BOOL16 WINAPI
ShowWindow16( HWND16 hwnd
, INT16 cmd
)
293 return ShowWindow( WIN_Handle32(hwnd
), cmd
);
297 /**************************************************************************
298 * CloseWindow (USER.43)
300 BOOL16 WINAPI
CloseWindow16( HWND16 hwnd
)
302 return CloseWindow( WIN_Handle32(hwnd
) );
306 /**************************************************************************
309 BOOL16 WINAPI
OpenIcon16( HWND16 hwnd
)
311 return OpenIcon( WIN_Handle32(hwnd
) );
315 /**************************************************************************
316 * BringWindowToTop (USER.45)
318 BOOL16 WINAPI
BringWindowToTop16( HWND16 hwnd
)
320 return BringWindowToTop( WIN_Handle32(hwnd
) );
324 /**************************************************************************
325 * GetParent (USER.46)
327 HWND16 WINAPI
GetParent16( HWND16 hwnd
)
329 return HWND_16( GetParent( WIN_Handle32(hwnd
) ));
333 /**************************************************************************
336 BOOL16 WINAPI
IsWindow16( HWND16 hwnd
)
338 CURRENT_STACK16
->es
= USER_HeapSel
;
339 /* don't use WIN_Handle32 here, we don't care about the full handle */
340 return IsWindow( HWND_32(hwnd
) );
344 /**************************************************************************
347 BOOL16 WINAPI
IsChild16( HWND16 parent
, HWND16 child
)
349 return IsChild( WIN_Handle32(parent
), WIN_Handle32(child
) );
353 /**************************************************************************
354 * IsWindowVisible (USER.49)
356 BOOL16 WINAPI
IsWindowVisible16( HWND16 hwnd
)
358 return IsWindowVisible( WIN_Handle32(hwnd
) );
362 /**************************************************************************
363 * FindWindow (USER.50)
365 HWND16 WINAPI
FindWindow16( LPCSTR className
, LPCSTR title
)
367 return HWND_16( FindWindowA( className
, title
));
371 /**************************************************************************
372 * DestroyWindow (USER.53)
374 BOOL16 WINAPI
DestroyWindow16( HWND16 hwnd
)
376 return DestroyWindow( WIN_Handle32(hwnd
) );
380 /*******************************************************************
381 * EnumWindows (USER.54)
383 BOOL16 WINAPI
EnumWindows16( WNDENUMPROC16 func
, LPARAM lParam
)
385 struct wnd_enum_info info
;
389 return EnumWindows( wnd_enum_callback
, (LPARAM
)&info
);
393 /**********************************************************************
394 * EnumChildWindows (USER.55)
396 BOOL16 WINAPI
EnumChildWindows16( HWND16 parent
, WNDENUMPROC16 func
, LPARAM lParam
)
398 struct wnd_enum_info info
;
402 return EnumChildWindows( WIN_Handle32(parent
), wnd_enum_callback
, (LPARAM
)&info
);
406 /**************************************************************************
407 * MoveWindow (USER.56)
409 BOOL16 WINAPI
MoveWindow16( HWND16 hwnd
, INT16 x
, INT16 y
, INT16 cx
, INT16 cy
, BOOL16 repaint
)
411 return MoveWindow( WIN_Handle32(hwnd
), x
, y
, cx
, cy
, repaint
);
415 /**************************************************************************
416 * GetClassName (USER.58)
418 INT16 WINAPI
GetClassName16( HWND16 hwnd
, LPSTR buffer
, INT16 count
)
420 return GetClassNameA( WIN_Handle32(hwnd
), buffer
, count
);
424 /**************************************************************************
425 * SetActiveWindow (USER.59)
427 HWND16 WINAPI
SetActiveWindow16( HWND16 hwnd
)
429 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd
) ));
433 /**************************************************************************
434 * GetActiveWindow (USER.60)
436 HWND16 WINAPI
GetActiveWindow16(void)
438 return HWND_16( GetActiveWindow() );
442 /**************************************************************************
443 * ScrollWindow (USER.61)
445 void WINAPI
ScrollWindow16( HWND16 hwnd
, INT16 dx
, INT16 dy
, const RECT16
*rect
,
446 const RECT16
*clipRect
)
448 RECT rect32
, clipRect32
;
450 if (rect
) CONV_RECT16TO32( rect
, &rect32
);
451 if (clipRect
) CONV_RECT16TO32( clipRect
, &clipRect32
);
452 ScrollWindow( WIN_Handle32(hwnd
), dx
, dy
, rect
? &rect32
: NULL
,
453 clipRect
? &clipRect32
: NULL
);
457 /**************************************************************************
458 * SetScrollPos (USER.62)
460 INT16 WINAPI
SetScrollPos16( HWND16 hwnd
, INT16 nBar
, INT16 nPos
, BOOL16 redraw
)
462 return SetScrollPos( WIN_Handle32(hwnd
), nBar
, nPos
, redraw
);
466 /**************************************************************************
467 * GetScrollPos (USER.63)
469 INT16 WINAPI
GetScrollPos16( HWND16 hwnd
, INT16 nBar
)
471 return GetScrollPos( WIN_Handle32(hwnd
), nBar
);
475 /**************************************************************************
476 * SetScrollRange (USER.64)
478 void WINAPI
SetScrollRange16( HWND16 hwnd
, INT16 nBar
, INT16 MinVal
, INT16 MaxVal
, BOOL16 redraw
)
480 /* Invalid range -> range is set to (0,0) */
481 if ((INT
)MaxVal
- (INT
)MinVal
> 0x7fff) MinVal
= MaxVal
= 0;
482 SetScrollRange( WIN_Handle32(hwnd
), nBar
, MinVal
, MaxVal
, redraw
);
486 /**************************************************************************
487 * GetScrollRange (USER.65)
489 BOOL16 WINAPI
GetScrollRange16( HWND16 hwnd
, INT16 nBar
, LPINT16 lpMin
, LPINT16 lpMax
)
492 BOOL ret
= GetScrollRange( WIN_Handle32(hwnd
), nBar
, &min
, &max
);
493 if (lpMin
) *lpMin
= min
;
494 if (lpMax
) *lpMax
= max
;
499 /**************************************************************************
502 HDC16 WINAPI
GetDC16( HWND16 hwnd
)
504 return HDC_16(GetDC( WIN_Handle32(hwnd
) ));
508 /**************************************************************************
509 * GetWindowDC (USER.67)
511 HDC16 WINAPI
GetWindowDC16( HWND16 hwnd
)
513 return GetDCEx16( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
);
517 /**************************************************************************
518 * ReleaseDC (USER.68)
520 INT16 WINAPI
ReleaseDC16( HWND16 hwnd
, HDC16 hdc
)
522 return (INT16
)ReleaseDC( WIN_Handle32(hwnd
), HDC_32(hdc
) );
526 /**************************************************************************
527 * FlashWindow (USER.105)
529 BOOL16 WINAPI
FlashWindow16( HWND16 hwnd
, BOOL16 bInvert
)
531 return FlashWindow( WIN_Handle32(hwnd
), bInvert
);
535 /**************************************************************************
536 * WindowFromDC (USER.117)
538 HWND16 WINAPI
WindowFromDC16( HDC16 hDC
)
540 return HWND_16( WindowFromDC( HDC_32(hDC
) ) );
544 /**************************************************************************
545 * UpdateWindow (USER.124)
547 void WINAPI
UpdateWindow16( HWND16 hwnd
)
549 RedrawWindow16( hwnd
, NULL
, 0, RDW_UPDATENOW
| RDW_ALLCHILDREN
);
553 /**************************************************************************
554 * InvalidateRect (USER.125)
556 void WINAPI
InvalidateRect16( HWND16 hwnd
, const RECT16
*rect
, BOOL16 erase
)
558 RedrawWindow16( hwnd
, rect
, 0, RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0) );
562 /**************************************************************************
563 * InvalidateRgn (USER.126)
565 void WINAPI
InvalidateRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 erase
)
567 RedrawWindow16( hwnd
, NULL
, hrgn
, RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0) );
571 /**************************************************************************
572 * ValidateRect (USER.127)
574 void WINAPI
ValidateRect16( HWND16 hwnd
, const RECT16
*rect
)
576 RedrawWindow16( hwnd
, rect
, 0, RDW_VALIDATE
| RDW_NOCHILDREN
);
580 /**************************************************************************
581 * ValidateRgn (USER.128)
583 void WINAPI
ValidateRgn16( HWND16 hwnd
, HRGN16 hrgn
)
585 RedrawWindow16( hwnd
, NULL
, hrgn
, RDW_VALIDATE
| RDW_NOCHILDREN
);
589 /**************************************************************************
590 * GetClassWord (USER.129)
592 WORD WINAPI
GetClassWord16( HWND16 hwnd
, INT16 offset
)
594 return GetClassWord( WIN_Handle32(hwnd
), offset
);
598 /**************************************************************************
599 * SetClassWord (USER.130)
601 WORD WINAPI
SetClassWord16( HWND16 hwnd
, INT16 offset
, WORD newval
)
603 return SetClassWord( WIN_Handle32(hwnd
), offset
, newval
);
607 /**************************************************************************
608 * GetWindowWord (USER.133)
610 WORD WINAPI
GetWindowWord16( HWND16 hwnd
, INT16 offset
)
612 return GetWindowWord( WIN_Handle32(hwnd
), offset
);
616 /**************************************************************************
617 * SetWindowWord (USER.134)
619 WORD WINAPI
SetWindowWord16( HWND16 hwnd
, INT16 offset
, WORD newval
)
621 return SetWindowWord( WIN_Handle32(hwnd
), offset
, newval
);
625 /**************************************************************************
626 * OpenClipboard (USER.137)
628 BOOL16 WINAPI
OpenClipboard16( HWND16 hwnd
)
630 return OpenClipboard( WIN_Handle32(hwnd
) );
634 /**************************************************************************
635 * GetClipboardOwner (USER.140)
637 HWND16 WINAPI
GetClipboardOwner16(void)
639 return HWND_16( GetClipboardOwner() );
643 /**************************************************************************
644 * SetClipboardViewer (USER.147)
646 HWND16 WINAPI
SetClipboardViewer16( HWND16 hwnd
)
648 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd
) ));
652 /**************************************************************************
653 * GetClipboardViewer (USER.148)
655 HWND16 WINAPI
GetClipboardViewer16(void)
657 return HWND_16( GetClipboardViewer() );
661 /**************************************************************************
662 * ChangeClipboardChain (USER.149)
664 BOOL16 WINAPI
ChangeClipboardChain16(HWND16 hwnd
, HWND16 hwndNext
)
666 return ChangeClipboardChain( WIN_Handle32(hwnd
), WIN_Handle32(hwndNext
) );
670 /**************************************************************************
671 * GetSystemMenu (USER.156)
673 HMENU16 WINAPI
GetSystemMenu16( HWND16 hwnd
, BOOL16 revert
)
675 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd
), revert
));
679 /**************************************************************************
682 HMENU16 WINAPI
GetMenu16( HWND16 hwnd
)
684 return HMENU_16(GetMenu( WIN_Handle32(hwnd
) ));
688 /**************************************************************************
691 BOOL16 WINAPI
SetMenu16( HWND16 hwnd
, HMENU16 hMenu
)
693 return SetMenu( WIN_Handle32(hwnd
), HMENU_32(hMenu
) );
697 /**************************************************************************
698 * DrawMenuBar (USER.160)
700 void WINAPI
DrawMenuBar16( HWND16 hwnd
)
702 DrawMenuBar( WIN_Handle32(hwnd
) );
706 /**************************************************************************
707 * HiliteMenuItem (USER.162)
709 BOOL16 WINAPI
HiliteMenuItem16( HWND16 hwnd
, HMENU16 hMenu
, UINT16 id
, UINT16 wHilite
)
711 return HiliteMenuItem( WIN_Handle32(hwnd
), HMENU_32(hMenu
), id
, wHilite
);
715 /**************************************************************************
716 * CreateCaret (USER.163)
718 void WINAPI
CreateCaret16( HWND16 hwnd
, HBITMAP16 bitmap
, INT16 width
, INT16 height
)
720 CreateCaret( WIN_Handle32(hwnd
), HBITMAP_32(bitmap
), width
, height
);
724 /*****************************************************************
725 * DestroyCaret (USER.164)
727 void WINAPI
DestroyCaret16(void)
733 /*****************************************************************
734 * SetCaretPos (USER.165)
736 void WINAPI
SetCaretPos16( INT16 x
, INT16 y
)
742 /**************************************************************************
743 * HideCaret (USER.166)
745 void WINAPI
HideCaret16( HWND16 hwnd
)
747 HideCaret( WIN_Handle32(hwnd
) );
751 /**************************************************************************
752 * ShowCaret (USER.167)
754 void WINAPI
ShowCaret16( HWND16 hwnd
)
756 ShowCaret( WIN_Handle32(hwnd
) );
760 /*****************************************************************
761 * SetCaretBlinkTime (USER.168)
763 void WINAPI
SetCaretBlinkTime16( UINT16 msecs
)
765 SetCaretBlinkTime( msecs
);
769 /*****************************************************************
770 * GetCaretBlinkTime (USER.169)
772 UINT16 WINAPI
GetCaretBlinkTime16(void)
774 return GetCaretBlinkTime();
778 /**************************************************************************
779 * ArrangeIconicWindows (USER.170)
781 UINT16 WINAPI
ArrangeIconicWindows16( HWND16 parent
)
783 return ArrangeIconicWindows( WIN_Handle32(parent
) );
787 /**************************************************************************
788 * SwitchToThisWindow (USER.172)
790 void WINAPI
SwitchToThisWindow16( HWND16 hwnd
, BOOL16 restore
)
792 SwitchToThisWindow( WIN_Handle32(hwnd
), restore
);
796 /**************************************************************************
797 * KillSystemTimer (USER.182)
799 BOOL16 WINAPI
KillSystemTimer16( HWND16 hwnd
, UINT16 id
)
801 return KillSystemTimer( WIN_Handle32(hwnd
), id
);
805 /*****************************************************************
806 * GetCaretPos (USER.183)
808 void WINAPI
GetCaretPos16( LPPOINT16 pt16
)
811 if (GetCaretPos( &pt
))
819 /**************************************************************************
820 * SetSysModalWindow (USER.188)
822 HWND16 WINAPI
SetSysModalWindow16( HWND16 hwnd
)
824 HWND16 old
= hwndSysModal
;
830 /**************************************************************************
831 * GetSysModalWindow (USER.189)
833 HWND16 WINAPI
GetSysModalWindow16(void)
839 /**************************************************************************
840 * GetUpdateRect (USER.190)
842 BOOL16 WINAPI
GetUpdateRect16( HWND16 hwnd
, LPRECT16 rect
, BOOL16 erase
)
847 if (!rect
) return GetUpdateRect( WIN_Handle32(hwnd
), NULL
, erase
);
848 ret
= GetUpdateRect( WIN_Handle32(hwnd
), &r
, erase
);
849 CONV_RECT32TO16( &r
, rect
);
854 /**************************************************************************
855 * ChildWindowFromPoint (USER.191)
857 HWND16 WINAPI
ChildWindowFromPoint16( HWND16 hwndParent
, POINT16 pt
)
860 CONV_POINT16TO32( &pt
, &pt32
);
861 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent
), pt32
));
865 /***********************************************************************
866 * GetWindowTask (USER.224)
868 HTASK16 WINAPI
GetWindowTask16( HWND16 hwnd
)
870 DWORD tid
= GetWindowThreadProcessId( HWND_32(hwnd
), NULL
);
872 return HTASK_16(tid
);
875 /**********************************************************************
876 * EnumTaskWindows (USER.225)
878 BOOL16 WINAPI
EnumTaskWindows16( HTASK16 hTask
, WNDENUMPROC16 func
, LPARAM lParam
)
880 struct wnd_enum_info info
;
881 DWORD tid
= HTASK_32( hTask
);
883 if (!tid
) return FALSE
;
886 return EnumThreadWindows( tid
, wnd_enum_callback
, (LPARAM
)&info
);
890 /**************************************************************************
891 * GetTopWindow (USER.229)
893 HWND16 WINAPI
GetTopWindow16( HWND16 hwnd
)
895 return HWND_16( GetTopWindow( WIN_Handle32(hwnd
) ));
899 /**************************************************************************
900 * GetNextWindow (USER.230)
902 HWND16 WINAPI
GetNextWindow16( HWND16 hwnd
, WORD flag
)
904 if ((flag
!= GW_HWNDNEXT
) && (flag
!= GW_HWNDPREV
)) return 0;
905 return GetWindow16( hwnd
, flag
);
909 /**************************************************************************
910 * SetWindowPos (USER.232)
912 BOOL16 WINAPI
SetWindowPos16( HWND16 hwnd
, HWND16 hwndInsertAfter
,
913 INT16 x
, INT16 y
, INT16 cx
, INT16 cy
, WORD flags
)
915 return SetWindowPos( WIN_Handle32(hwnd
), full_insert_after_hwnd(hwndInsertAfter
),
916 x
, y
, cx
, cy
, flags
);
920 /**************************************************************************
921 * SetParent (USER.233)
923 HWND16 WINAPI
SetParent16( HWND16 hwndChild
, HWND16 hwndNewParent
)
925 return HWND_16( SetParent( WIN_Handle32(hwndChild
), WIN_Handle32(hwndNewParent
) ));
929 /**************************************************************************
930 * GetCapture (USER.236)
932 HWND16 WINAPI
GetCapture16(void)
934 return HWND_16( GetCapture() );
938 /**************************************************************************
939 * GetUpdateRgn (USER.237)
941 INT16 WINAPI
GetUpdateRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 erase
)
943 return GetUpdateRgn( WIN_Handle32(hwnd
), HRGN_32(hrgn
), erase
);
947 /**************************************************************************
948 * ExcludeUpdateRgn (USER.238)
950 INT16 WINAPI
ExcludeUpdateRgn16( HDC16 hdc
, HWND16 hwnd
)
952 return ExcludeUpdateRgn( HDC_32(hdc
), WIN_Handle32(hwnd
) );
956 /**************************************************************************
957 * GetOpenClipboardWindow (USER.248)
959 HWND16 WINAPI
GetOpenClipboardWindow16(void)
961 return HWND_16( GetOpenClipboardWindow() );
965 /**************************************************************************
966 * BeginDeferWindowPos (USER.259)
968 HDWP16 WINAPI
BeginDeferWindowPos16( INT16 count
)
970 return HDWP_16(BeginDeferWindowPos( count
));
974 /**************************************************************************
975 * DeferWindowPos (USER.260)
977 HDWP16 WINAPI
DeferWindowPos16( HDWP16 hdwp
, HWND16 hwnd
, HWND16 hwndAfter
,
978 INT16 x
, INT16 y
, INT16 cx
, INT16 cy
,
981 return HDWP_16(DeferWindowPos( HDWP_32(hdwp
), WIN_Handle32(hwnd
),
982 full_insert_after_hwnd(hwndAfter
), x
, y
, cx
, cy
, flags
));
986 /**************************************************************************
987 * EndDeferWindowPos (USER.261)
989 BOOL16 WINAPI
EndDeferWindowPos16( HDWP16 hdwp
)
991 return EndDeferWindowPos(HDWP_32(hdwp
));
995 /**************************************************************************
996 * GetWindow (USER.262)
998 HWND16 WINAPI
GetWindow16( HWND16 hwnd
, WORD rel
)
1000 return HWND_16( GetWindow( WIN_Handle32(hwnd
), rel
) );
1004 /**************************************************************************
1005 * ShowOwnedPopups (USER.265)
1007 void WINAPI
ShowOwnedPopups16( HWND16 owner
, BOOL16 fShow
)
1009 ShowOwnedPopups( WIN_Handle32(owner
), fShow
);
1013 /**************************************************************************
1014 * ShowScrollBar (USER.267)
1016 void WINAPI
ShowScrollBar16( HWND16 hwnd
, INT16 nBar
, BOOL16 fShow
)
1018 ShowScrollBar( WIN_Handle32(hwnd
), nBar
, fShow
);
1022 /**************************************************************************
1023 * IsZoomed (USER.272)
1025 BOOL16 WINAPI
IsZoomed16(HWND16 hwnd
)
1027 return IsZoomed( WIN_Handle32(hwnd
) );
1031 /**************************************************************************
1032 * GetDlgCtrlID (USER.277)
1034 INT16 WINAPI
GetDlgCtrlID16( HWND16 hwnd
)
1036 return GetDlgCtrlID( WIN_Handle32(hwnd
) );
1040 /**************************************************************************
1041 * GetDesktopHwnd (USER.278)
1043 * Exactly the same thing as GetDesktopWindow(), but not documented.
1044 * Don't ask me why...
1046 HWND16 WINAPI
GetDesktopHwnd16(void)
1048 return GetDesktopWindow16();
1052 /**************************************************************************
1053 * SetSystemMenu (USER.280)
1055 BOOL16 WINAPI
SetSystemMenu16( HWND16 hwnd
, HMENU16 hMenu
)
1057 return SetSystemMenu( WIN_Handle32(hwnd
), HMENU_32(hMenu
) );
1061 /**************************************************************************
1062 * GetDesktopWindow (USER.286)
1064 HWND16 WINAPI
GetDesktopWindow16(void)
1066 return HWND_16( GetDesktopWindow() );
1070 /**************************************************************************
1071 * GetLastActivePopup (USER.287)
1073 HWND16 WINAPI
GetLastActivePopup16( HWND16 hwnd
)
1075 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd
) ));
1079 /**************************************************************************
1080 * RedrawWindow (USER.290)
1082 BOOL16 WINAPI
RedrawWindow16( HWND16 hwnd
, const RECT16
*rectUpdate
,
1083 HRGN16 hrgnUpdate
, UINT16 flags
)
1088 CONV_RECT16TO32( rectUpdate
, &r
);
1089 return RedrawWindow(WIN_Handle32(hwnd
), &r
, HRGN_32(hrgnUpdate
), flags
);
1091 return RedrawWindow(WIN_Handle32(hwnd
), NULL
, HRGN_32(hrgnUpdate
), flags
);
1095 /**************************************************************************
1096 * LockWindowUpdate (USER.294)
1098 BOOL16 WINAPI
LockWindowUpdate16( HWND16 hwnd
)
1100 return LockWindowUpdate( WIN_Handle32(hwnd
) );
1104 /**************************************************************************
1105 * ScrollWindowEx (USER.319)
1107 INT16 WINAPI
ScrollWindowEx16( HWND16 hwnd
, INT16 dx
, INT16 dy
,
1108 const RECT16
*rect
, const RECT16
*clipRect
,
1109 HRGN16 hrgnUpdate
, LPRECT16 rcUpdate
,
1112 RECT rect32
, clipRect32
, rcUpdate32
;
1115 if (rect
) CONV_RECT16TO32( rect
, &rect32
);
1116 if (clipRect
) CONV_RECT16TO32( clipRect
, &clipRect32
);
1117 ret
= ScrollWindowEx( WIN_Handle32(hwnd
), dx
, dy
, rect
? &rect32
: NULL
,
1118 clipRect
? &clipRect32
: NULL
, HRGN_32(hrgnUpdate
),
1119 (rcUpdate
) ? &rcUpdate32
: NULL
, flags
);
1120 if (rcUpdate
) CONV_RECT32TO16( &rcUpdate32
, rcUpdate
);
1125 /**************************************************************************
1126 * FillWindow (USER.324)
1128 void WINAPI
FillWindow16( HWND16 hwndParent
, HWND16 hwnd
, HDC16 hdc
, HBRUSH16 hbrush
)
1132 GetClientRect( WIN_Handle32(hwnd
), &rect
);
1133 DPtoLP( HDC_32(hdc
), (LPPOINT
)&rect
, 2 );
1134 CONV_RECT32TO16( &rect
, &rc16
);
1135 PaintRect16( hwndParent
, hwnd
, hdc
, hbrush
, &rc16
);
1139 /**************************************************************************
1140 * PaintRect (USER.325)
1142 void WINAPI
PaintRect16( HWND16 hwndParent
, HWND16 hwnd
, HDC16 hdc
,
1143 HBRUSH16 hbrush
, const RECT16
*rect
)
1145 if (hbrush
<= CTLCOLOR_STATIC
)
1147 HWND parent
= WIN_Handle32(hwndParent
), hwnd32
= WIN_Handle32(hwnd
);
1149 if (!parent
) return;
1150 hbrush
= SendMessageW( parent
, WM_CTLCOLORMSGBOX
+ hbrush
, (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1151 if (!hbrush
) hbrush
= DefWindowProcW( parent
, WM_CTLCOLORMSGBOX
+ hbrush
,
1152 (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1154 if (hbrush
) FillRect16( hdc
, rect
, hbrush
);
1158 /**************************************************************************
1159 * GetControlBrush (USER.326)
1161 HBRUSH16 WINAPI
GetControlBrush16( HWND16 hwnd
, HDC16 hdc
, UINT16 ctlType
)
1164 HWND hwnd32
= WIN_Handle32(hwnd
);
1165 HWND parent
= GetParent( hwnd32
);
1167 if (!parent
) parent
= hwnd32
;
1168 ret
= SendMessageW( parent
, WM_CTLCOLORMSGBOX
+ ctlType
, (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1169 if (!ret
) ret
= DefWindowProcW( parent
, WM_CTLCOLORMSGBOX
+ ctlType
,
1170 (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1175 /**************************************************************************
1176 * GetDCEx (USER.359)
1178 HDC16 WINAPI
GetDCEx16( HWND16 hwnd
, HRGN16 hrgnClip
, DWORD flags
)
1180 return HDC_16(GetDCEx(WIN_Handle32(hwnd
), HRGN_32(hrgnClip
), flags
));
1184 /**************************************************************************
1185 * GetWindowPlacement (USER.370)
1187 BOOL16 WINAPI
GetWindowPlacement16( HWND16 hwnd
, WINDOWPLACEMENT16
*wp16
)
1189 WINDOWPLACEMENT wpl
;
1191 wpl
.length
= sizeof(wpl
);
1192 if (!GetWindowPlacement( WIN_Handle32(hwnd
), &wpl
)) return FALSE
;
1193 wp16
->length
= sizeof(*wp16
);
1194 wp16
->flags
= wpl
.flags
;
1195 wp16
->showCmd
= wpl
.showCmd
;
1196 CONV_POINT32TO16( &wpl
.ptMinPosition
, &wp16
->ptMinPosition
);
1197 CONV_POINT32TO16( &wpl
.ptMaxPosition
, &wp16
->ptMaxPosition
);
1198 CONV_RECT32TO16( &wpl
.rcNormalPosition
, &wp16
->rcNormalPosition
);
1203 /**************************************************************************
1204 * SetWindowPlacement (USER.371)
1206 BOOL16 WINAPI
SetWindowPlacement16( HWND16 hwnd
, const WINDOWPLACEMENT16
*wp16
)
1208 WINDOWPLACEMENT wpl
;
1210 if (!wp16
) return FALSE
;
1211 wpl
.length
= sizeof(wpl
);
1212 wpl
.flags
= wp16
->flags
;
1213 wpl
.showCmd
= wp16
->showCmd
;
1214 wpl
.ptMinPosition
.x
= wp16
->ptMinPosition
.x
;
1215 wpl
.ptMinPosition
.y
= wp16
->ptMinPosition
.y
;
1216 wpl
.ptMaxPosition
.x
= wp16
->ptMaxPosition
.x
;
1217 wpl
.ptMaxPosition
.y
= wp16
->ptMaxPosition
.y
;
1218 wpl
.rcNormalPosition
.left
= wp16
->rcNormalPosition
.left
;
1219 wpl
.rcNormalPosition
.top
= wp16
->rcNormalPosition
.top
;
1220 wpl
.rcNormalPosition
.right
= wp16
->rcNormalPosition
.right
;
1221 wpl
.rcNormalPosition
.bottom
= wp16
->rcNormalPosition
.bottom
;
1222 return SetWindowPlacement( WIN_Handle32(hwnd
), &wpl
);
1226 /**************************************************************************
1227 * ChildWindowFromPointEx (USER.399)
1229 HWND16 WINAPI
ChildWindowFromPointEx16( HWND16 hwndParent
, POINT16 pt
, UINT16 uFlags
)
1232 CONV_POINT16TO32( &pt
, &pt32
);
1233 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent
), pt32
, uFlags
));
1237 /**************************************************************************
1238 * GetPriorityClipboardFormat (USER.402)
1240 INT16 WINAPI
GetPriorityClipboardFormat16( UINT16
*list
, INT16 count
)
1244 for (i
= 0; i
< count
; i
++)
1245 if (IsClipboardFormatAvailable( list
[i
] )) return list
[i
];
1250 /**************************************************************************
1251 * TrackPopupMenu (USER.416)
1253 BOOL16 WINAPI
TrackPopupMenu16( HMENU16 hMenu
, UINT16 wFlags
, INT16 x
, INT16 y
,
1254 INT16 nReserved
, HWND16 hwnd
, const RECT16
*lpRect
)
1257 if (lpRect
) CONV_RECT16TO32( lpRect
, &r
);
1258 return TrackPopupMenu( HMENU_32(hMenu
), wFlags
, x
, y
, nReserved
,
1259 WIN_Handle32(hwnd
), lpRect
? &r
: NULL
);
1263 /**************************************************************************
1264 * FindWindowEx (USER.427)
1266 HWND16 WINAPI
FindWindowEx16( HWND16 parent
, HWND16 child
, LPCSTR className
, LPCSTR title
)
1268 return HWND_16( FindWindowExA( WIN_Handle32(parent
), WIN_Handle32(child
),
1269 className
, title
));
1273 /**************************************************************************
1274 * DrawAnimatedRects (USER.448)
1276 BOOL16 WINAPI
DrawAnimatedRects16( HWND16 hwnd
, INT16 idAni
,
1277 const RECT16
* lprcFrom
, const RECT16
* lprcTo
)
1279 RECT rcFrom32
, rcTo32
;
1280 rcFrom32
.left
= lprcFrom
->left
;
1281 rcFrom32
.top
= lprcFrom
->top
;
1282 rcFrom32
.right
= lprcFrom
->right
;
1283 rcFrom32
.bottom
= lprcFrom
->bottom
;
1284 rcTo32
.left
= lprcTo
->left
;
1285 rcTo32
.top
= lprcTo
->top
;
1286 rcTo32
.right
= lprcTo
->right
;
1287 rcTo32
.bottom
= lprcTo
->bottom
;
1288 return DrawAnimatedRects( WIN_Handle32(hwnd
), idAni
, &rcFrom32
, &rcTo32
);
1292 /***********************************************************************
1293 * GetInternalWindowPos (USER.460)
1295 UINT16 WINAPI
GetInternalWindowPos16( HWND16 hwnd
, LPRECT16 rectWnd
, LPPOINT16 ptIcon
)
1297 WINDOWPLACEMENT16 wndpl
;
1299 if (!GetWindowPlacement16( hwnd
, &wndpl
)) return 0;
1300 if (rectWnd
) *rectWnd
= wndpl
.rcNormalPosition
;
1301 if (ptIcon
) *ptIcon
= wndpl
.ptMinPosition
;
1302 return wndpl
.showCmd
;
1306 /**************************************************************************
1307 * SetInternalWindowPos (USER.461)
1309 void WINAPI
SetInternalWindowPos16( HWND16 hwnd
, UINT16 showCmd
, LPRECT16 rect
, LPPOINT16 pt
)
1316 rc32
.left
= rect
->left
;
1317 rc32
.top
= rect
->top
;
1318 rc32
.right
= rect
->right
;
1319 rc32
.bottom
= rect
->bottom
;
1326 SetInternalWindowPos( WIN_Handle32(hwnd
), showCmd
,
1327 rect
? &rc32
: NULL
, pt
? &pt32
: NULL
);
1331 /**************************************************************************
1332 * CalcChildScroll (USER.462)
1334 void WINAPI
CalcChildScroll16( HWND16 hwnd
, WORD scroll
)
1336 CalcChildScroll( WIN_Handle32(hwnd
), scroll
);
1340 /**************************************************************************
1341 * ScrollChildren (USER.463)
1343 void WINAPI
ScrollChildren16(HWND16 hwnd
, UINT16 uMsg
, WPARAM16 wParam
, LPARAM lParam
)
1345 ScrollChildren( WIN_Handle32(hwnd
), uMsg
, wParam
, lParam
);
1349 /**************************************************************************
1350 * DragDetect (USER.465)
1352 BOOL16 WINAPI
DragDetect16( HWND16 hwnd
, POINT16 pt
)
1355 CONV_POINT16TO32( &pt
, &pt32
);
1356 return DragDetect( WIN_Handle32(hwnd
), pt32
);
1360 /**************************************************************************
1361 * SetScrollInfo (USER.475)
1363 INT16 WINAPI
SetScrollInfo16( HWND16 hwnd
, INT16 nBar
, const SCROLLINFO
*info
, BOOL16 redraw
)
1365 return SetScrollInfo( WIN_Handle32(hwnd
), nBar
, info
, redraw
);
1369 /**************************************************************************
1370 * GetScrollInfo (USER.476)
1372 BOOL16 WINAPI
GetScrollInfo16( HWND16 hwnd
, INT16 nBar
, LPSCROLLINFO info
)
1374 return GetScrollInfo( WIN_Handle32(hwnd
), nBar
, info
);
1378 /**************************************************************************
1379 * EnableScrollBar (USER.482)
1381 BOOL16 WINAPI
EnableScrollBar16( HWND16 hwnd
, INT16 nBar
, UINT16 flags
)
1383 return EnableScrollBar( WIN_Handle32(hwnd
), nBar
, flags
);
1387 /**************************************************************************
1388 * GetShellWindow (USER.600)
1390 HWND16 WINAPI
GetShellWindow16(void)
1392 return HWND_16( GetShellWindow() );
1396 /**************************************************************************
1397 * GetForegroundWindow (USER.608)
1399 HWND16 WINAPI
GetForegroundWindow16(void)
1401 return HWND_16( GetForegroundWindow() );
1405 /**************************************************************************
1406 * SetForegroundWindow (USER.609)
1408 BOOL16 WINAPI
SetForegroundWindow16( HWND16 hwnd
)
1410 return SetForegroundWindow( WIN_Handle32(hwnd
) );
1414 /**************************************************************************
1415 * DrawCaptionTemp (USER.657)
1417 BOOL16 WINAPI
DrawCaptionTemp16( HWND16 hwnd
, HDC16 hdc
, const RECT16
*rect
,
1418 HFONT16 hFont
, HICON16 hIcon
, LPCSTR str
, UINT16 uFlags
)
1422 if (rect
) CONV_RECT16TO32(rect
,&rect32
);
1424 return DrawCaptionTempA( WIN_Handle32(hwnd
), HDC_32(hdc
),
1425 rect
? &rect32
: NULL
, HFONT_32(hFont
),
1426 HICON_32(hIcon
), str
, uFlags
& 0x1f );
1430 /**************************************************************************
1431 * DrawCaption (USER.660)
1433 BOOL16 WINAPI
DrawCaption16( HWND16 hwnd
, HDC16 hdc
, const RECT16
*rect
, UINT16 flags
)
1437 if (rect
) CONV_RECT16TO32( rect
, &rect32
);
1439 return DrawCaption(WIN_Handle32(hwnd
), HDC_32(hdc
), rect
? &rect32
: NULL
, flags
);
1443 /**************************************************************************
1444 * GetMenuItemRect (USER.665)
1446 BOOL16 WINAPI
GetMenuItemRect16( HWND16 hwnd
, HMENU16 hMenu
, UINT16 uItem
,
1451 if (!rect
) return FALSE
;
1452 res
= GetMenuItemRect( WIN_Handle32(hwnd
), HMENU_32(hMenu
), uItem
, &r32
);
1453 CONV_RECT32TO16( &r32
, rect
);
1458 /**************************************************************************
1459 * SetWindowRgn (USER.668)
1461 INT16 WINAPI
SetWindowRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 redraw
)
1463 return SetWindowRgn( WIN_Handle32(hwnd
), HRGN_32(hrgn
), redraw
);
1467 /**************************************************************************
1468 * MessageBoxIndirect (USER.827)
1470 INT16 WINAPI
MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox
)
1472 MSGBOXPARAMSA msgbox32
;
1474 msgbox32
.cbSize
= msgbox
->cbSize
;
1475 msgbox32
.hwndOwner
= WIN_Handle32( msgbox
->hwndOwner
);
1476 msgbox32
.hInstance
= MapHModuleSL(msgbox
->hInstance
);
1477 msgbox32
.lpszText
= MapSL(msgbox
->lpszText
);
1478 msgbox32
.lpszCaption
= MapSL(msgbox
->lpszCaption
);
1479 msgbox32
.dwStyle
= msgbox
->dwStyle
;
1480 msgbox32
.lpszIcon
= MapSL(msgbox
->lpszIcon
);
1481 msgbox32
.dwContextHelpId
= msgbox
->dwContextHelpId
;
1482 msgbox32
.lpfnMsgBoxCallback
= msgbox
->lpfnMsgBoxCallback
;
1483 msgbox32
.dwLanguageId
= msgbox
->dwLanguageId
;
1484 return MessageBoxIndirectA( &msgbox32
);