user32: Move Get/SetWindowLong16 implementation to wnd16.c.
[wine/multimedia.git] / dlls / user32 / wnd16.c
blobf3f7e67fb9ff412e5a57bc863ba87b58e76a1676
1 /*
2 * 16-bit windowing functions
4 * Copyright 2001 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/winuser16.h"
22 #include "wownt32.h"
23 #include "win.h"
24 #include "user_private.h"
26 /* handle <--> handle16 conversions */
27 #define HANDLE_16(h32) (LOWORD(h32))
28 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
30 static HWND16 hwndSysModal;
32 struct wnd_enum_info
34 WNDENUMPROC16 proc;
35 LPARAM param;
38 /* callback for 16-bit window enumeration functions */
39 static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param )
41 const struct wnd_enum_info *info = (struct wnd_enum_info *)param;
42 WORD args[3];
43 DWORD ret;
45 args[2] = HWND_16(hwnd);
46 args[1] = HIWORD(info->param);
47 args[0] = LOWORD(info->param);
48 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
49 return LOWORD(ret);
52 /* convert insert after window handle to 32-bit */
53 static inline HWND full_insert_after_hwnd( HWND16 hwnd )
55 HWND ret = WIN_Handle32( hwnd );
56 if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
57 return ret;
60 /**************************************************************************
61 * MessageBox (USER.1)
63 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
65 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
69 /***********************************************************************
70 * SetTimer (USER.10)
72 UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
74 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
75 return SetTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
79 /***********************************************************************
80 * SetSystemTimer (USER.11)
82 UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
84 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
85 return SetSystemTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
89 /**************************************************************************
90 * KillTimer (USER.12)
92 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
94 return KillTimer( WIN_Handle32(hwnd), id );
98 /**************************************************************************
99 * SetCapture (USER.18)
101 HWND16 WINAPI SetCapture16( HWND16 hwnd )
103 return HWND_16( SetCapture( WIN_Handle32(hwnd) ));
107 /**************************************************************************
108 * ReleaseCapture (USER.19)
110 BOOL16 WINAPI ReleaseCapture16(void)
112 return ReleaseCapture();
116 /**************************************************************************
117 * SetFocus (USER.22)
119 HWND16 WINAPI SetFocus16( HWND16 hwnd )
121 return HWND_16( SetFocus( WIN_Handle32(hwnd) ));
125 /**************************************************************************
126 * GetFocus (USER.23)
128 HWND16 WINAPI GetFocus16(void)
130 return HWND_16( GetFocus() );
134 /**************************************************************************
135 * RemoveProp (USER.24)
137 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
139 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd), str ));
143 /**************************************************************************
144 * GetProp (USER.25)
146 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
148 return HANDLE_16(GetPropA( WIN_Handle32(hwnd), str ));
152 /**************************************************************************
153 * SetProp (USER.26)
155 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
157 return SetPropA( WIN_Handle32(hwnd), str, HANDLE_32(handle) );
161 /**************************************************************************
162 * ClientToScreen (USER.28)
164 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
166 MapWindowPoints16( hwnd, 0, lppnt, 1 );
170 /**************************************************************************
171 * ScreenToClient (USER.29)
173 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
175 MapWindowPoints16( 0, hwnd, lppnt, 1 );
179 /**************************************************************************
180 * WindowFromPoint (USER.30)
182 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
184 POINT pt32;
186 pt32.x = pt.x;
187 pt32.y = pt.y;
188 return HWND_16( WindowFromPoint( pt32 ) );
192 /**************************************************************************
193 * IsIconic (USER.31)
195 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
197 return IsIconic( WIN_Handle32(hwnd) );
201 /**************************************************************************
202 * GetWindowRect (USER.32)
204 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
206 RECT rect32;
208 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
209 rect->left = rect32.left;
210 rect->top = rect32.top;
211 rect->right = rect32.right;
212 rect->bottom = rect32.bottom;
216 /**************************************************************************
217 * GetClientRect (USER.33)
219 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
221 RECT rect32;
223 GetClientRect( WIN_Handle32(hwnd), &rect32 );
224 rect->left = rect32.left;
225 rect->top = rect32.top;
226 rect->right = rect32.right;
227 rect->bottom = rect32.bottom;
231 /**************************************************************************
232 * EnableWindow (USER.34)
234 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
236 return EnableWindow( WIN_Handle32(hwnd), enable );
240 /**************************************************************************
241 * IsWindowEnabled (USER.35)
243 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
245 return IsWindowEnabled( WIN_Handle32(hwnd) );
249 /**************************************************************************
250 * GetWindowText (USER.36)
252 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
254 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
258 /**************************************************************************
259 * SetWindowText (USER.37)
261 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
263 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
267 /**************************************************************************
268 * GetWindowTextLength (USER.38)
270 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
272 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
276 /***********************************************************************
277 * BeginPaint (USER.39)
279 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
281 PAINTSTRUCT ps;
283 BeginPaint( WIN_Handle32(hwnd), &ps );
284 lps->hdc = HDC_16(ps.hdc);
285 lps->fErase = ps.fErase;
286 lps->rcPaint.top = ps.rcPaint.top;
287 lps->rcPaint.left = ps.rcPaint.left;
288 lps->rcPaint.right = ps.rcPaint.right;
289 lps->rcPaint.bottom = ps.rcPaint.bottom;
290 lps->fRestore = ps.fRestore;
291 lps->fIncUpdate = ps.fIncUpdate;
292 return lps->hdc;
296 /***********************************************************************
297 * EndPaint (USER.40)
299 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
301 PAINTSTRUCT ps;
303 ps.hdc = HDC_32(lps->hdc);
304 return EndPaint( WIN_Handle32(hwnd), &ps );
308 /**************************************************************************
309 * ShowWindow (USER.42)
311 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
313 return ShowWindow( WIN_Handle32(hwnd), cmd );
317 /**************************************************************************
318 * CloseWindow (USER.43)
320 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
322 return CloseWindow( WIN_Handle32(hwnd) );
326 /**************************************************************************
327 * OpenIcon (USER.44)
329 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
331 return OpenIcon( WIN_Handle32(hwnd) );
335 /**************************************************************************
336 * BringWindowToTop (USER.45)
338 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
340 return BringWindowToTop( WIN_Handle32(hwnd) );
344 /**************************************************************************
345 * GetParent (USER.46)
347 HWND16 WINAPI GetParent16( HWND16 hwnd )
349 return HWND_16( GetParent( WIN_Handle32(hwnd) ));
353 /**************************************************************************
354 * IsWindow (USER.47)
356 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
358 STACK16FRAME *frame = MapSL( (SEGPTR)NtCurrentTeb()->WOW32Reserved );
359 frame->es = USER_HeapSel;
360 /* don't use WIN_Handle32 here, we don't care about the full handle */
361 return IsWindow( HWND_32(hwnd) );
365 /**************************************************************************
366 * IsChild (USER.48)
368 BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
370 return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
374 /**************************************************************************
375 * IsWindowVisible (USER.49)
377 BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
379 return IsWindowVisible( WIN_Handle32(hwnd) );
383 /**************************************************************************
384 * FindWindow (USER.50)
386 HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
388 return HWND_16( FindWindowA( className, title ));
392 /**************************************************************************
393 * DestroyWindow (USER.53)
395 BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
397 return DestroyWindow( WIN_Handle32(hwnd) );
401 /*******************************************************************
402 * EnumWindows (USER.54)
404 BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
406 struct wnd_enum_info info;
408 info.proc = func;
409 info.param = lParam;
410 return EnumWindows( wnd_enum_callback, (LPARAM)&info );
414 /**********************************************************************
415 * EnumChildWindows (USER.55)
417 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
419 struct wnd_enum_info info;
421 info.proc = func;
422 info.param = lParam;
423 return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info );
427 /**************************************************************************
428 * MoveWindow (USER.56)
430 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
432 return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
436 /***********************************************************************
437 * RegisterClass (USER.57)
439 ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
441 WNDCLASSEX16 wcex;
443 wcex.cbSize = sizeof(wcex);
444 wcex.style = wc->style;
445 wcex.lpfnWndProc = wc->lpfnWndProc;
446 wcex.cbClsExtra = wc->cbClsExtra;
447 wcex.cbWndExtra = wc->cbWndExtra;
448 wcex.hInstance = wc->hInstance;
449 wcex.hIcon = wc->hIcon;
450 wcex.hCursor = wc->hCursor;
451 wcex.hbrBackground = wc->hbrBackground;
452 wcex.lpszMenuName = wc->lpszMenuName;
453 wcex.lpszClassName = wc->lpszClassName;
454 wcex.hIconSm = 0;
455 return RegisterClassEx16( &wcex );
459 /**************************************************************************
460 * GetClassName (USER.58)
462 INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
464 return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
468 /**************************************************************************
469 * SetActiveWindow (USER.59)
471 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
473 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd) ));
477 /**************************************************************************
478 * GetActiveWindow (USER.60)
480 HWND16 WINAPI GetActiveWindow16(void)
482 return HWND_16( GetActiveWindow() );
486 /**************************************************************************
487 * ScrollWindow (USER.61)
489 void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
490 const RECT16 *clipRect )
492 RECT rect32, clipRect32;
494 if (rect)
496 rect32.left = rect->left;
497 rect32.top = rect->top;
498 rect32.right = rect->right;
499 rect32.bottom = rect->bottom;
501 if (clipRect)
503 clipRect32.left = clipRect->left;
504 clipRect32.top = clipRect->top;
505 clipRect32.right = clipRect->right;
506 clipRect32.bottom = clipRect->bottom;
508 ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
509 clipRect ? &clipRect32 : NULL );
513 /**************************************************************************
514 * SetScrollPos (USER.62)
516 INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
518 return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
522 /**************************************************************************
523 * GetScrollPos (USER.63)
525 INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
527 return GetScrollPos( WIN_Handle32(hwnd), nBar );
531 /**************************************************************************
532 * SetScrollRange (USER.64)
534 void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
536 /* Invalid range -> range is set to (0,0) */
537 if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
538 SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
542 /**************************************************************************
543 * GetScrollRange (USER.65)
545 BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
547 INT min, max;
548 BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
549 if (lpMin) *lpMin = min;
550 if (lpMax) *lpMax = max;
551 return ret;
555 /**************************************************************************
556 * GetDC (USER.66)
558 HDC16 WINAPI GetDC16( HWND16 hwnd )
560 return HDC_16(GetDC( WIN_Handle32(hwnd) ));
564 /**************************************************************************
565 * GetWindowDC (USER.67)
567 HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
569 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
573 /**************************************************************************
574 * ReleaseDC (USER.68)
576 INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
578 return (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) );
582 /**************************************************************************
583 * FlashWindow (USER.105)
585 BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
587 return FlashWindow( WIN_Handle32(hwnd), bInvert );
591 /**************************************************************************
592 * WindowFromDC (USER.117)
594 HWND16 WINAPI WindowFromDC16( HDC16 hDC )
596 return HWND_16( WindowFromDC( HDC_32(hDC) ) );
600 /**************************************************************************
601 * UpdateWindow (USER.124)
603 void WINAPI UpdateWindow16( HWND16 hwnd )
605 RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
609 /**************************************************************************
610 * InvalidateRect (USER.125)
612 void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
614 RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
618 /**************************************************************************
619 * InvalidateRgn (USER.126)
621 void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
623 RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
627 /**************************************************************************
628 * ValidateRect (USER.127)
630 void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
632 RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
636 /**************************************************************************
637 * ValidateRgn (USER.128)
639 void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
641 RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
645 /**************************************************************************
646 * GetClassWord (USER.129)
648 WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
650 return GetClassWord( WIN_Handle32(hwnd), offset );
654 /**************************************************************************
655 * SetClassWord (USER.130)
657 WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
659 return SetClassWord( WIN_Handle32(hwnd), offset, newval );
663 /***********************************************************************
664 * GetClassLong (USER.131)
666 LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
668 LONG_PTR ret = GetClassLongA( WIN_Handle32(hwnd16), offset );
670 switch( offset )
672 case GCLP_WNDPROC:
673 return (LONG_PTR)WINPROC_GetProc16( (WNDPROC)ret, FALSE );
674 case GCLP_MENUNAME:
675 return MapLS( (void *)ret ); /* leak */
676 default:
677 return ret;
682 /***********************************************************************
683 * SetClassLong (USER.132)
685 LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
687 switch( offset )
689 case GCLP_WNDPROC:
691 WNDPROC new_proc = WINPROC_AllocProc16( (WNDPROC16)newval );
692 WNDPROC old_proc = (WNDPROC)SetClassLongA( WIN_Handle32(hwnd16), offset, (LONG_PTR)new_proc );
693 return (LONG)WINPROC_GetProc16( old_proc, FALSE );
695 case GCLP_MENUNAME:
696 newval = (LONG)MapSL( newval );
697 /* fall through */
698 default:
699 return SetClassLongA( WIN_Handle32(hwnd16), offset, newval );
704 /**************************************************************************
705 * GetWindowWord (USER.133)
707 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
709 return GetWindowWord( WIN_Handle32(hwnd), offset );
713 /**************************************************************************
714 * SetWindowWord (USER.134)
716 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
718 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
722 /**********************************************************************
723 * GetWindowLong (USER.135)
725 LONG WINAPI GetWindowLong16( HWND16 hwnd, INT16 offset )
727 WND *wndPtr;
728 LONG_PTR retvalue;
729 BOOL is_winproc = (offset == GWLP_WNDPROC);
731 if (offset >= 0)
733 if (!(wndPtr = WIN_GetPtr( WIN_Handle32(hwnd) )))
735 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
736 return 0;
738 if (wndPtr != WND_OTHER_PROCESS && wndPtr != WND_DESKTOP)
740 if (offset > (int)(wndPtr->cbWndExtra - sizeof(LONG)))
743 * Some programs try to access last element from 16 bit
744 * code using illegal offset value. Hopefully this is
745 * what those programs really expect.
747 if (wndPtr->cbWndExtra >= 4 && offset == wndPtr->cbWndExtra - sizeof(WORD))
749 offset = wndPtr->cbWndExtra - sizeof(LONG);
751 else
753 WIN_ReleasePtr( wndPtr );
754 SetLastError( ERROR_INVALID_INDEX );
755 return 0;
758 is_winproc = ((offset == DWLP_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG));
759 WIN_ReleasePtr( wndPtr );
762 retvalue = GetWindowLongA( WIN_Handle32(hwnd), offset );
763 if (is_winproc) retvalue = (LONG_PTR)WINPROC_GetProc16( (WNDPROC)retvalue, FALSE );
764 return retvalue;
768 /**********************************************************************
769 * SetWindowLong (USER.136)
771 LONG WINAPI SetWindowLong16( HWND16 hwnd, INT16 offset, LONG newval )
773 WND *wndPtr;
774 BOOL is_winproc = (offset == GWLP_WNDPROC);
776 if (offset == DWLP_DLGPROC)
778 if (!(wndPtr = WIN_GetPtr( WIN_Handle32(hwnd) )))
780 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
781 return 0;
783 if (wndPtr != WND_OTHER_PROCESS && wndPtr != WND_DESKTOP)
785 is_winproc = ((wndPtr->cbWndExtra - sizeof(LONG_PTR) >= DWLP_DLGPROC) &&
786 (wndPtr->flags & WIN_ISDIALOG));
787 WIN_ReleasePtr( wndPtr );
791 if (is_winproc)
793 WNDPROC new_proc = WINPROC_AllocProc16( (WNDPROC16)newval );
794 WNDPROC old_proc = (WNDPROC)SetWindowLongPtrA( WIN_Handle32(hwnd), offset, (LONG_PTR)new_proc );
795 return (LONG)WINPROC_GetProc16( old_proc, FALSE );
797 else return SetWindowLongA( WIN_Handle32(hwnd), offset, newval );
801 /**************************************************************************
802 * OpenClipboard (USER.137)
804 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
806 return OpenClipboard( WIN_Handle32(hwnd) );
810 /**************************************************************************
811 * GetClipboardOwner (USER.140)
813 HWND16 WINAPI GetClipboardOwner16(void)
815 return HWND_16( GetClipboardOwner() );
819 /**************************************************************************
820 * SetClipboardViewer (USER.147)
822 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
824 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd) ));
828 /**************************************************************************
829 * GetClipboardViewer (USER.148)
831 HWND16 WINAPI GetClipboardViewer16(void)
833 return HWND_16( GetClipboardViewer() );
837 /**************************************************************************
838 * ChangeClipboardChain (USER.149)
840 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
842 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
846 /**************************************************************************
847 * GetSystemMenu (USER.156)
849 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
851 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd), revert ));
855 /**************************************************************************
856 * GetMenu (USER.157)
858 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
860 return HMENU_16(GetMenu( WIN_Handle32(hwnd) ));
864 /**************************************************************************
865 * SetMenu (USER.158)
867 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
869 return SetMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
873 /**************************************************************************
874 * DrawMenuBar (USER.160)
876 void WINAPI DrawMenuBar16( HWND16 hwnd )
878 DrawMenuBar( WIN_Handle32(hwnd) );
882 /**************************************************************************
883 * HiliteMenuItem (USER.162)
885 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
887 return HiliteMenuItem( WIN_Handle32(hwnd), HMENU_32(hMenu), id, wHilite );
891 /**************************************************************************
892 * CreateCaret (USER.163)
894 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
896 CreateCaret( WIN_Handle32(hwnd), HBITMAP_32(bitmap), width, height );
900 /*****************************************************************
901 * DestroyCaret (USER.164)
903 void WINAPI DestroyCaret16(void)
905 DestroyCaret();
909 /*****************************************************************
910 * SetCaretPos (USER.165)
912 void WINAPI SetCaretPos16( INT16 x, INT16 y )
914 SetCaretPos( x, y );
918 /**************************************************************************
919 * HideCaret (USER.166)
921 void WINAPI HideCaret16( HWND16 hwnd )
923 HideCaret( WIN_Handle32(hwnd) );
927 /**************************************************************************
928 * ShowCaret (USER.167)
930 void WINAPI ShowCaret16( HWND16 hwnd )
932 ShowCaret( WIN_Handle32(hwnd) );
936 /*****************************************************************
937 * SetCaretBlinkTime (USER.168)
939 void WINAPI SetCaretBlinkTime16( UINT16 msecs )
941 SetCaretBlinkTime( msecs );
945 /*****************************************************************
946 * GetCaretBlinkTime (USER.169)
948 UINT16 WINAPI GetCaretBlinkTime16(void)
950 return GetCaretBlinkTime();
954 /**************************************************************************
955 * ArrangeIconicWindows (USER.170)
957 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
959 return ArrangeIconicWindows( WIN_Handle32(parent) );
963 /**************************************************************************
964 * SwitchToThisWindow (USER.172)
966 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
968 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
972 /**************************************************************************
973 * KillSystemTimer (USER.182)
975 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
977 return KillSystemTimer( WIN_Handle32(hwnd), id );
981 /*****************************************************************
982 * GetCaretPos (USER.183)
984 void WINAPI GetCaretPos16( LPPOINT16 pt16 )
986 POINT pt;
987 if (GetCaretPos( &pt ))
989 pt16->x = pt.x;
990 pt16->y = pt.y;
995 /**************************************************************************
996 * SetSysModalWindow (USER.188)
998 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
1000 HWND16 old = hwndSysModal;
1001 hwndSysModal = hwnd;
1002 return old;
1006 /**************************************************************************
1007 * GetSysModalWindow (USER.189)
1009 HWND16 WINAPI GetSysModalWindow16(void)
1011 return hwndSysModal;
1015 /**************************************************************************
1016 * GetUpdateRect (USER.190)
1018 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
1020 RECT r;
1021 BOOL16 ret;
1023 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
1024 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
1025 rect->left = r.left;
1026 rect->top = r.top;
1027 rect->right = r.right;
1028 rect->bottom = r.bottom;
1029 return ret;
1033 /**************************************************************************
1034 * ChildWindowFromPoint (USER.191)
1036 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
1038 POINT pt32;
1040 pt32.x = pt.x;
1041 pt32.y = pt.y;
1042 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
1046 /***********************************************************************
1047 * CascadeChildWindows (USER.198)
1049 void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
1051 CascadeWindows( WIN_Handle32(parent), action, NULL, 0, NULL );
1055 /***********************************************************************
1056 * TileChildWindows (USER.199)
1058 void WINAPI TileChildWindows16( HWND16 parent, WORD action )
1060 TileWindows( WIN_Handle32(parent), action, NULL, 0, NULL );
1064 /***********************************************************************
1065 * GetWindowTask (USER.224)
1067 HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
1069 DWORD tid = GetWindowThreadProcessId( HWND_32(hwnd), NULL );
1070 if (!tid) return 0;
1071 return HTASK_16(tid);
1074 /**********************************************************************
1075 * EnumTaskWindows (USER.225)
1077 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
1079 struct wnd_enum_info info;
1080 DWORD tid = HTASK_32( hTask );
1082 if (!tid) return FALSE;
1083 info.proc = func;
1084 info.param = lParam;
1085 return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
1089 /**************************************************************************
1090 * GetTopWindow (USER.229)
1092 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
1094 return HWND_16( GetTopWindow( WIN_Handle32(hwnd) ));
1098 /**************************************************************************
1099 * GetNextWindow (USER.230)
1101 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
1103 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
1104 return GetWindow16( hwnd, flag );
1108 /**************************************************************************
1109 * SetWindowPos (USER.232)
1111 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
1112 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
1114 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
1115 x, y, cx, cy, flags );
1119 /**************************************************************************
1120 * SetParent (USER.233)
1122 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
1124 return HWND_16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
1128 /**************************************************************************
1129 * GetCapture (USER.236)
1131 HWND16 WINAPI GetCapture16(void)
1133 return HWND_16( GetCapture() );
1137 /**************************************************************************
1138 * GetUpdateRgn (USER.237)
1140 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
1142 return GetUpdateRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), erase );
1146 /**************************************************************************
1147 * ExcludeUpdateRgn (USER.238)
1149 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
1151 return ExcludeUpdateRgn( HDC_32(hdc), WIN_Handle32(hwnd) );
1155 /**************************************************************************
1156 * GetOpenClipboardWindow (USER.248)
1158 HWND16 WINAPI GetOpenClipboardWindow16(void)
1160 return HWND_16( GetOpenClipboardWindow() );
1164 /**************************************************************************
1165 * BeginDeferWindowPos (USER.259)
1167 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1169 return HDWP_16(BeginDeferWindowPos( count ));
1173 /**************************************************************************
1174 * DeferWindowPos (USER.260)
1176 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1177 INT16 x, INT16 y, INT16 cx, INT16 cy,
1178 UINT16 flags )
1180 return HDWP_16(DeferWindowPos( HDWP_32(hdwp), WIN_Handle32(hwnd),
1181 full_insert_after_hwnd(hwndAfter), x, y, cx, cy, flags ));
1185 /**************************************************************************
1186 * EndDeferWindowPos (USER.261)
1188 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1190 return EndDeferWindowPos(HDWP_32(hdwp));
1194 /**************************************************************************
1195 * GetWindow (USER.262)
1197 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1199 return HWND_16( GetWindow( WIN_Handle32(hwnd), rel ) );
1203 /**************************************************************************
1204 * ShowOwnedPopups (USER.265)
1206 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1208 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1212 /**************************************************************************
1213 * ShowScrollBar (USER.267)
1215 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1217 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1221 /**************************************************************************
1222 * IsZoomed (USER.272)
1224 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1226 return IsZoomed( WIN_Handle32(hwnd) );
1230 /**************************************************************************
1231 * GetDlgCtrlID (USER.277)
1233 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1235 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1239 /**************************************************************************
1240 * GetDesktopHwnd (USER.278)
1242 * Exactly the same thing as GetDesktopWindow(), but not documented.
1243 * Don't ask me why...
1245 HWND16 WINAPI GetDesktopHwnd16(void)
1247 return GetDesktopWindow16();
1251 /**************************************************************************
1252 * SetSystemMenu (USER.280)
1254 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1256 return SetSystemMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
1260 /**************************************************************************
1261 * GetDesktopWindow (USER.286)
1263 HWND16 WINAPI GetDesktopWindow16(void)
1265 return HWND_16( GetDesktopWindow() );
1269 /**************************************************************************
1270 * GetLastActivePopup (USER.287)
1272 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1274 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1278 /**************************************************************************
1279 * RedrawWindow (USER.290)
1281 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1282 HRGN16 hrgnUpdate, UINT16 flags )
1284 if (rectUpdate)
1286 RECT r;
1287 r.left = rectUpdate->left;
1288 r.top = rectUpdate->top;
1289 r.right = rectUpdate->right;
1290 r.bottom = rectUpdate->bottom;
1291 return RedrawWindow(WIN_Handle32(hwnd), &r, HRGN_32(hrgnUpdate), flags);
1293 return RedrawWindow(WIN_Handle32(hwnd), NULL, HRGN_32(hrgnUpdate), flags);
1297 /**************************************************************************
1298 * LockWindowUpdate (USER.294)
1300 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1302 return LockWindowUpdate( WIN_Handle32(hwnd) );
1306 /**************************************************************************
1307 * ScrollWindowEx (USER.319)
1309 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1310 const RECT16 *rect, const RECT16 *clipRect,
1311 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1312 UINT16 flags )
1314 RECT rect32, clipRect32, rcUpdate32;
1315 BOOL16 ret;
1317 if (rect)
1319 rect32.left = rect->left;
1320 rect32.top = rect->top;
1321 rect32.right = rect->right;
1322 rect32.bottom = rect->bottom;
1324 if (clipRect)
1326 clipRect32.left = clipRect->left;
1327 clipRect32.top = clipRect->top;
1328 clipRect32.right = clipRect->right;
1329 clipRect32.bottom = clipRect->bottom;
1331 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1332 clipRect ? &clipRect32 : NULL, HRGN_32(hrgnUpdate),
1333 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1334 if (rcUpdate)
1336 rcUpdate->left = rcUpdate32.left;
1337 rcUpdate->top = rcUpdate32.top;
1338 rcUpdate->right = rcUpdate32.right;
1339 rcUpdate->bottom = rcUpdate32.bottom;
1341 return ret;
1345 /**************************************************************************
1346 * FillWindow (USER.324)
1348 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1350 RECT rect;
1351 RECT16 rc16;
1352 GetClientRect( WIN_Handle32(hwnd), &rect );
1353 DPtoLP( HDC_32(hdc), (LPPOINT)&rect, 2 );
1354 rc16.left = rect.left;
1355 rc16.top = rect.top;
1356 rc16.right = rect.right;
1357 rc16.bottom = rect.bottom;
1358 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1362 /**************************************************************************
1363 * PaintRect (USER.325)
1365 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1366 HBRUSH16 hbrush, const RECT16 *rect)
1368 if (hbrush <= CTLCOLOR_STATIC)
1370 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1372 if (!parent) return;
1373 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1374 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1375 (WPARAM)hdc, (LPARAM)hwnd32 );
1377 if (hbrush) FillRect16( hdc, rect, hbrush );
1381 /**************************************************************************
1382 * GetControlBrush (USER.326)
1384 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1386 HBRUSH16 ret;
1387 HWND hwnd32 = WIN_Handle32(hwnd);
1388 HWND parent = GetParent( hwnd32 );
1390 if (!parent) parent = hwnd32;
1391 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1392 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1393 (WPARAM)hdc, (LPARAM)hwnd32 );
1394 return ret;
1398 /**************************************************************************
1399 * GetDCEx (USER.359)
1401 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1403 return HDC_16(GetDCEx(WIN_Handle32(hwnd), HRGN_32(hrgnClip), flags));
1407 /**************************************************************************
1408 * GetWindowPlacement (USER.370)
1410 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1412 WINDOWPLACEMENT wpl;
1414 wpl.length = sizeof(wpl);
1415 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1416 wp16->length = sizeof(*wp16);
1417 wp16->flags = wpl.flags;
1418 wp16->showCmd = wpl.showCmd;
1419 wp16->ptMinPosition.x = wpl.ptMinPosition.x;
1420 wp16->ptMinPosition.y = wpl.ptMinPosition.y;
1421 wp16->ptMaxPosition.x = wpl.ptMaxPosition.x;
1422 wp16->ptMaxPosition.y = wpl.ptMaxPosition.y;
1423 wp16->rcNormalPosition.left = wpl.rcNormalPosition.left;
1424 wp16->rcNormalPosition.top = wpl.rcNormalPosition.top;
1425 wp16->rcNormalPosition.right = wpl.rcNormalPosition.right;
1426 wp16->rcNormalPosition.bottom = wpl.rcNormalPosition.bottom;
1427 return TRUE;
1431 /**************************************************************************
1432 * SetWindowPlacement (USER.371)
1434 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1436 WINDOWPLACEMENT wpl;
1438 if (!wp16) return FALSE;
1439 wpl.length = sizeof(wpl);
1440 wpl.flags = wp16->flags;
1441 wpl.showCmd = wp16->showCmd;
1442 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1443 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1444 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1445 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1446 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1447 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1448 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1449 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1450 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1454 /***********************************************************************
1455 * RegisterClassEx (USER.397)
1457 ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
1459 WNDCLASSEXA wc32;
1461 wc32.cbSize = sizeof(wc32);
1462 wc32.style = wc->style;
1463 wc32.lpfnWndProc = WINPROC_AllocProc16( wc->lpfnWndProc );
1464 wc32.cbClsExtra = wc->cbClsExtra;
1465 wc32.cbWndExtra = wc->cbWndExtra;
1466 wc32.hInstance = HINSTANCE_32(GetExePtr(wc->hInstance));
1467 if (!wc32.hInstance) wc32.hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
1468 wc32.hIcon = HICON_32(wc->hIcon);
1469 wc32.hCursor = HCURSOR_32(wc->hCursor);
1470 wc32.hbrBackground = HBRUSH_32(wc->hbrBackground);
1471 wc32.lpszMenuName = MapSL(wc->lpszMenuName);
1472 wc32.lpszClassName = MapSL(wc->lpszClassName);
1473 wc32.hIconSm = HICON_32(wc->hIconSm);
1474 return RegisterClassExA( &wc32 );
1478 /***********************************************************************
1479 * GetClassInfoEx (USER.398)
1481 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1482 * same in Win16 as in Win32. --AJ
1484 BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
1486 WNDCLASSEXA wc32;
1487 HINSTANCE hInstance;
1488 BOOL ret;
1490 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1491 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
1493 ret = GetClassInfoExA( hInstance, MapSL(name), &wc32 );
1495 if (ret)
1497 wc->lpfnWndProc = WINPROC_GetProc16( wc32.lpfnWndProc, FALSE );
1498 wc->style = wc32.style;
1499 wc->cbClsExtra = wc32.cbClsExtra;
1500 wc->cbWndExtra = wc32.cbWndExtra;
1501 wc->hInstance = (wc32.hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(wc32.hInstance);
1502 wc->hIcon = HICON_16(wc32.hIcon);
1503 wc->hIconSm = HICON_16(wc32.hIconSm);
1504 wc->hCursor = HCURSOR_16(wc32.hCursor);
1505 wc->hbrBackground = HBRUSH_16(wc32.hbrBackground);
1506 wc->lpszClassName = 0;
1507 wc->lpszMenuName = MapLS(wc32.lpszMenuName); /* FIXME: leak */
1509 return ret;
1513 /**************************************************************************
1514 * ChildWindowFromPointEx (USER.399)
1516 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1518 POINT pt32;
1520 pt32.x = pt.x;
1521 pt32.y = pt.y;
1522 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1526 /**************************************************************************
1527 * GetPriorityClipboardFormat (USER.402)
1529 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1531 int i;
1533 for (i = 0; i < count; i++)
1534 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1535 return -1;
1539 /***********************************************************************
1540 * UnregisterClass (USER.403)
1542 BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
1544 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
1545 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
1549 /***********************************************************************
1550 * GetClassInfo (USER.404)
1552 BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
1554 WNDCLASSEX16 wcex;
1555 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
1557 if (ret)
1559 wc->style = wcex.style;
1560 wc->lpfnWndProc = wcex.lpfnWndProc;
1561 wc->cbClsExtra = wcex.cbClsExtra;
1562 wc->cbWndExtra = wcex.cbWndExtra;
1563 wc->hInstance = wcex.hInstance;
1564 wc->hIcon = wcex.hIcon;
1565 wc->hCursor = wcex.hCursor;
1566 wc->hbrBackground = wcex.hbrBackground;
1567 wc->lpszMenuName = wcex.lpszMenuName;
1568 wc->lpszClassName = wcex.lpszClassName;
1570 return ret;
1574 /**************************************************************************
1575 * TrackPopupMenu (USER.416)
1577 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1578 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1580 RECT r;
1581 if (lpRect)
1583 r.left = lpRect->left;
1584 r.top = lpRect->top;
1585 r.right = lpRect->right;
1586 r.bottom = lpRect->bottom;
1588 return TrackPopupMenu( HMENU_32(hMenu), wFlags, x, y, nReserved,
1589 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1593 /**************************************************************************
1594 * FindWindowEx (USER.427)
1596 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1598 return HWND_16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1599 className, title ));
1603 /***********************************************************************
1604 * DefFrameProc (USER.445)
1606 LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient,
1607 UINT16 message, WPARAM16 wParam, LPARAM lParam )
1609 switch (message)
1611 case WM_SETTEXT:
1612 lParam = (LPARAM)MapSL(lParam);
1613 /* fall through */
1614 case WM_COMMAND:
1615 case WM_NCACTIVATE:
1616 case WM_SETFOCUS:
1617 case WM_SIZE:
1618 return DefFrameProcA( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1619 message, wParam, lParam );
1621 case WM_NEXTMENU:
1623 MDINEXTMENU next_menu;
1624 DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1625 message, wParam, (LPARAM)&next_menu );
1626 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1628 default:
1629 return DefWindowProc16(hwnd, message, wParam, lParam);
1634 /***********************************************************************
1635 * DefMDIChildProc (USER.447)
1637 LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
1638 WPARAM16 wParam, LPARAM lParam )
1640 switch (message)
1642 case WM_SETTEXT:
1643 return DefMDIChildProcA( WIN_Handle32(hwnd), message, wParam, (LPARAM)MapSL(lParam) );
1645 case WM_MENUCHAR:
1646 case WM_CLOSE:
1647 case WM_SETFOCUS:
1648 case WM_CHILDACTIVATE:
1649 case WM_SYSCOMMAND:
1650 case WM_SETVISIBLE:
1651 case WM_SIZE:
1652 case WM_SYSCHAR:
1653 return DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, lParam );
1655 case WM_GETMINMAXINFO:
1657 MINMAXINFO16 *mmi16 = MapSL(lParam);
1658 MINMAXINFO mmi;
1660 mmi.ptReserved.x = mmi16->ptReserved.x;
1661 mmi.ptReserved.y = mmi16->ptReserved.y;
1662 mmi.ptMaxSize.x = mmi16->ptMaxSize.x;
1663 mmi.ptMaxSize.y = mmi16->ptMaxSize.y;
1664 mmi.ptMaxPosition.x = mmi16->ptMaxPosition.x;
1665 mmi.ptMaxPosition.y = mmi16->ptMaxPosition.y;
1666 mmi.ptMinTrackSize.x = mmi16->ptMinTrackSize.x;
1667 mmi.ptMinTrackSize.y = mmi16->ptMinTrackSize.y;
1668 mmi.ptMaxTrackSize.x = mmi16->ptMaxTrackSize.x;
1669 mmi.ptMaxTrackSize.y = mmi16->ptMaxTrackSize.y;
1671 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&mmi );
1673 mmi16->ptReserved.x = mmi.ptReserved.x;
1674 mmi16->ptReserved.y = mmi.ptReserved.y;
1675 mmi16->ptMaxSize.x = mmi.ptMaxSize.x;
1676 mmi16->ptMaxSize.y = mmi.ptMaxSize.y;
1677 mmi16->ptMaxPosition.x = mmi.ptMaxPosition.x;
1678 mmi16->ptMaxPosition.y = mmi.ptMaxPosition.y;
1679 mmi16->ptMinTrackSize.x = mmi.ptMinTrackSize.x;
1680 mmi16->ptMinTrackSize.y = mmi.ptMinTrackSize.y;
1681 mmi16->ptMaxTrackSize.x = mmi.ptMaxTrackSize.x;
1682 mmi16->ptMaxTrackSize.y = mmi.ptMaxTrackSize.y;
1683 return 0;
1685 case WM_NEXTMENU:
1687 MDINEXTMENU next_menu;
1688 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
1689 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1691 default:
1692 return DefWindowProc16(hwnd, message, wParam, lParam);
1697 /**************************************************************************
1698 * DrawAnimatedRects (USER.448)
1700 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1701 const RECT16* lprcFrom, const RECT16* lprcTo )
1703 RECT rcFrom32, rcTo32;
1704 rcFrom32.left = lprcFrom->left;
1705 rcFrom32.top = lprcFrom->top;
1706 rcFrom32.right = lprcFrom->right;
1707 rcFrom32.bottom = lprcFrom->bottom;
1708 rcTo32.left = lprcTo->left;
1709 rcTo32.top = lprcTo->top;
1710 rcTo32.right = lprcTo->right;
1711 rcTo32.bottom = lprcTo->bottom;
1712 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1716 /***********************************************************************
1717 * GetInternalWindowPos (USER.460)
1719 UINT16 WINAPI GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd, LPPOINT16 ptIcon )
1721 WINDOWPLACEMENT16 wndpl;
1723 if (!GetWindowPlacement16( hwnd, &wndpl )) return 0;
1724 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1725 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1726 return wndpl.showCmd;
1730 /**************************************************************************
1731 * SetInternalWindowPos (USER.461)
1733 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1735 RECT rc32;
1736 POINT pt32;
1738 if (rect)
1740 rc32.left = rect->left;
1741 rc32.top = rect->top;
1742 rc32.right = rect->right;
1743 rc32.bottom = rect->bottom;
1745 if (pt)
1747 pt32.x = pt->x;
1748 pt32.y = pt->y;
1750 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1751 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1755 /**************************************************************************
1756 * CalcChildScroll (USER.462)
1758 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1760 CalcChildScroll( WIN_Handle32(hwnd), scroll );
1764 /**************************************************************************
1765 * ScrollChildren (USER.463)
1767 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1769 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1773 /**************************************************************************
1774 * DragDetect (USER.465)
1776 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1778 POINT pt32;
1780 pt32.x = pt.x;
1781 pt32.y = pt.y;
1782 return DragDetect( WIN_Handle32(hwnd), pt32 );
1786 /**************************************************************************
1787 * SetScrollInfo (USER.475)
1789 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1791 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1795 /**************************************************************************
1796 * GetScrollInfo (USER.476)
1798 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1800 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1804 /**************************************************************************
1805 * EnableScrollBar (USER.482)
1807 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1809 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1813 /**************************************************************************
1814 * GetShellWindow (USER.600)
1816 HWND16 WINAPI GetShellWindow16(void)
1818 return HWND_16( GetShellWindow() );
1822 /**************************************************************************
1823 * GetForegroundWindow (USER.608)
1825 HWND16 WINAPI GetForegroundWindow16(void)
1827 return HWND_16( GetForegroundWindow() );
1831 /**************************************************************************
1832 * SetForegroundWindow (USER.609)
1834 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1836 return SetForegroundWindow( WIN_Handle32(hwnd) );
1840 /**************************************************************************
1841 * DrawCaptionTemp (USER.657)
1843 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1844 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1846 RECT rect32;
1848 if (rect)
1850 rect32.left = rect->left;
1851 rect32.top = rect->top;
1852 rect32.right = rect->right;
1853 rect32.bottom = rect->bottom;
1855 return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc),
1856 rect ? &rect32 : NULL, HFONT_32(hFont),
1857 HICON_32(hIcon), str, uFlags & 0x1f );
1861 /**************************************************************************
1862 * DrawCaption (USER.660)
1864 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1866 RECT rect32;
1868 if (rect)
1870 rect32.left = rect->left;
1871 rect32.top = rect->top;
1872 rect32.right = rect->right;
1873 rect32.bottom = rect->bottom;
1875 return DrawCaption(WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, flags);
1879 /**************************************************************************
1880 * GetMenuItemRect (USER.665)
1882 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1883 LPRECT16 rect)
1885 RECT r32;
1886 BOOL res;
1887 if (!rect) return FALSE;
1888 res = GetMenuItemRect( WIN_Handle32(hwnd), HMENU_32(hMenu), uItem, &r32 );
1889 rect->left = r32.left;
1890 rect->top = r32.top;
1891 rect->right = r32.right;
1892 rect->bottom = r32.bottom;
1893 return res;
1897 /**************************************************************************
1898 * SetWindowRgn (USER.668)
1900 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1902 return SetWindowRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), redraw );
1906 /**************************************************************************
1907 * MessageBoxIndirect (USER.827)
1909 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1911 MSGBOXPARAMSA msgbox32;
1913 msgbox32.cbSize = msgbox->cbSize;
1914 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1915 msgbox32.hInstance = HINSTANCE_32(msgbox->hInstance);
1916 msgbox32.lpszText = MapSL(msgbox->lpszText);
1917 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1918 msgbox32.dwStyle = msgbox->dwStyle;
1919 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1920 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1921 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1922 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1923 return MessageBoxIndirectA( &msgbox32 );