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"
24 #include "user_private.h"
25 #include "wine/server.h"
27 /* size of buffer needed to store an atom string */
28 #define ATOM_BUFFER_SIZE 256
30 /* handle <--> handle16 conversions */
31 #define HANDLE_16(h32) (LOWORD(h32))
32 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
34 static HWND16 hwndSysModal;
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;
49 args[2] = HWND_16(hwnd);
50 args[1] = HIWORD(info->param);
51 args[0] = LOWORD(info->param);
52 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
56 /* convert insert after window handle to 32-bit */
57 static inline HWND full_insert_after_hwnd( HWND16 hwnd )
59 HWND ret = WIN_Handle32( hwnd );
60 if (ret == (HWND)0xffff) ret = HWND_TOPMOST;
64 /**************************************************************************
67 INT16 WINAPI MessageBox16( HWND16 hwnd, LPCSTR text, LPCSTR title, UINT16 type )
69 return MessageBoxA( WIN_Handle32(hwnd), text, title, type );
73 /***********************************************************************
76 UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
78 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
79 return SetTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
83 /***********************************************************************
84 * SetSystemTimer (USER.11)
86 UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
88 TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc );
89 return SetSystemTimer( WIN_Handle32(hwnd), id, timeout, proc32 );
93 /**************************************************************************
96 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
98 return KillTimer( WIN_Handle32(hwnd), id );
102 /**************************************************************************
103 * SetCapture (USER.18)
105 HWND16 WINAPI SetCapture16( HWND16 hwnd )
107 return HWND_16( SetCapture( WIN_Handle32(hwnd) ));
111 /**************************************************************************
112 * ReleaseCapture (USER.19)
114 BOOL16 WINAPI ReleaseCapture16(void)
116 return ReleaseCapture();
120 /**************************************************************************
123 HWND16 WINAPI SetFocus16( HWND16 hwnd )
125 return HWND_16( SetFocus( WIN_Handle32(hwnd) ));
129 /**************************************************************************
132 HWND16 WINAPI GetFocus16(void)
134 return HWND_16( GetFocus() );
138 /**************************************************************************
139 * RemoveProp (USER.24)
141 HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
143 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd), str ));
147 /**************************************************************************
150 HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
152 return HANDLE_16(GetPropA( WIN_Handle32(hwnd), str ));
156 /**************************************************************************
159 BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
161 return SetPropA( WIN_Handle32(hwnd), str, HANDLE_32(handle) );
165 /***********************************************************************
166 * EnumProps (USER.27)
168 INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func )
170 int ret = -1, i, count, total = 32;
171 property_data_t *list;
175 if (!(list = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*list) ))) break;
177 SERVER_START_REQ( get_window_properties )
179 req->window = wine_server_user_handle( HWND_32(hwnd) );
180 wine_server_set_reply( req, list, total * sizeof(*list) );
181 if (!wine_server_call( req )) count = reply->total;
185 if (count && count <= total)
187 char string[ATOM_BUFFER_SIZE];
188 SEGPTR segptr = MapLS( string );
192 for (i = 0; i < count; i++)
194 if (list[i].string) /* it was a string originally */
196 if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue;
198 args[2] = SELECTOROF(segptr);
199 args[1] = OFFSETOF(segptr);
200 args[0] = LOWORD(list[i].data);
206 args[1] = list[i].atom;
207 args[0] = LOWORD(list[i].data);
209 WOWCallback16Ex( (DWORD)func, WCB16_PASCAL, sizeof(args), args, &result );
210 if (!(ret = LOWORD(result))) break;
213 HeapFree( GetProcessHeap(), 0, list );
216 HeapFree( GetProcessHeap(), 0, list );
217 total = count; /* restart with larger buffer */
223 /**************************************************************************
224 * ClientToScreen (USER.28)
226 void WINAPI ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt )
228 MapWindowPoints16( hwnd, 0, lppnt, 1 );
232 /**************************************************************************
233 * ScreenToClient (USER.29)
235 void WINAPI ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt )
237 MapWindowPoints16( 0, hwnd, lppnt, 1 );
241 /**************************************************************************
242 * WindowFromPoint (USER.30)
244 HWND16 WINAPI WindowFromPoint16( POINT16 pt )
250 return HWND_16( WindowFromPoint( pt32 ) );
254 /**************************************************************************
257 BOOL16 WINAPI IsIconic16(HWND16 hwnd)
259 return IsIconic( WIN_Handle32(hwnd) );
263 /**************************************************************************
264 * GetWindowRect (USER.32)
266 void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
270 GetWindowRect( WIN_Handle32(hwnd), &rect32 );
271 rect->left = rect32.left;
272 rect->top = rect32.top;
273 rect->right = rect32.right;
274 rect->bottom = rect32.bottom;
278 /**************************************************************************
279 * GetClientRect (USER.33)
281 void WINAPI GetClientRect16( HWND16 hwnd, LPRECT16 rect )
285 GetClientRect( WIN_Handle32(hwnd), &rect32 );
286 rect->left = rect32.left;
287 rect->top = rect32.top;
288 rect->right = rect32.right;
289 rect->bottom = rect32.bottom;
293 /**************************************************************************
294 * EnableWindow (USER.34)
296 BOOL16 WINAPI EnableWindow16( HWND16 hwnd, BOOL16 enable )
298 return EnableWindow( WIN_Handle32(hwnd), enable );
302 /**************************************************************************
303 * IsWindowEnabled (USER.35)
305 BOOL16 WINAPI IsWindowEnabled16(HWND16 hwnd)
307 return IsWindowEnabled( WIN_Handle32(hwnd) );
311 /**************************************************************************
312 * GetWindowText (USER.36)
314 INT16 WINAPI GetWindowText16( HWND16 hwnd, SEGPTR lpString, INT16 nMaxCount )
316 return SendMessage16( hwnd, WM_GETTEXT, nMaxCount, lpString );
320 /**************************************************************************
321 * SetWindowText (USER.37)
323 BOOL16 WINAPI SetWindowText16( HWND16 hwnd, SEGPTR lpString )
325 return SendMessage16( hwnd, WM_SETTEXT, 0, (LPARAM)lpString );
329 /**************************************************************************
330 * GetWindowTextLength (USER.38)
332 INT16 WINAPI GetWindowTextLength16( HWND16 hwnd )
334 return SendMessage16( hwnd, WM_GETTEXTLENGTH, 0, 0 );
338 /***********************************************************************
339 * BeginPaint (USER.39)
341 HDC16 WINAPI BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps )
345 BeginPaint( WIN_Handle32(hwnd), &ps );
346 lps->hdc = HDC_16(ps.hdc);
347 lps->fErase = ps.fErase;
348 lps->rcPaint.top = ps.rcPaint.top;
349 lps->rcPaint.left = ps.rcPaint.left;
350 lps->rcPaint.right = ps.rcPaint.right;
351 lps->rcPaint.bottom = ps.rcPaint.bottom;
352 lps->fRestore = ps.fRestore;
353 lps->fIncUpdate = ps.fIncUpdate;
358 /***********************************************************************
361 BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
365 ps.hdc = HDC_32(lps->hdc);
366 return EndPaint( WIN_Handle32(hwnd), &ps );
370 /***********************************************************************
371 * CreateWindow (USER.41)
373 HWND16 WINAPI CreateWindow16( LPCSTR className, LPCSTR windowName,
374 DWORD style, INT16 x, INT16 y, INT16 width,
375 INT16 height, HWND16 parent, HMENU16 menu,
376 HINSTANCE16 instance, LPVOID data )
378 return CreateWindowEx16( 0, className, windowName, style,
379 x, y, width, height, parent, menu, instance, data );
383 /**************************************************************************
384 * ShowWindow (USER.42)
386 BOOL16 WINAPI ShowWindow16( HWND16 hwnd, INT16 cmd )
388 return ShowWindow( WIN_Handle32(hwnd), cmd );
392 /**************************************************************************
393 * CloseWindow (USER.43)
395 BOOL16 WINAPI CloseWindow16( HWND16 hwnd )
397 return CloseWindow( WIN_Handle32(hwnd) );
401 /**************************************************************************
404 BOOL16 WINAPI OpenIcon16( HWND16 hwnd )
406 return OpenIcon( WIN_Handle32(hwnd) );
410 /**************************************************************************
411 * BringWindowToTop (USER.45)
413 BOOL16 WINAPI BringWindowToTop16( HWND16 hwnd )
415 return BringWindowToTop( WIN_Handle32(hwnd) );
419 /**************************************************************************
420 * GetParent (USER.46)
422 HWND16 WINAPI GetParent16( HWND16 hwnd )
424 return HWND_16( GetParent( WIN_Handle32(hwnd) ));
428 /**************************************************************************
431 BOOL16 WINAPI IsWindow16( HWND16 hwnd )
433 STACK16FRAME *frame = MapSL( (SEGPTR)NtCurrentTeb()->WOW32Reserved );
434 frame->es = USER_HeapSel;
435 /* don't use WIN_Handle32 here, we don't care about the full handle */
436 return IsWindow( HWND_32(hwnd) );
440 /**************************************************************************
443 BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
445 return IsChild( WIN_Handle32(parent), WIN_Handle32(child) );
449 /**************************************************************************
450 * IsWindowVisible (USER.49)
452 BOOL16 WINAPI IsWindowVisible16( HWND16 hwnd )
454 return IsWindowVisible( WIN_Handle32(hwnd) );
458 /**************************************************************************
459 * FindWindow (USER.50)
461 HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
463 return HWND_16( FindWindowA( className, title ));
467 /**************************************************************************
468 * DestroyWindow (USER.53)
470 BOOL16 WINAPI DestroyWindow16( HWND16 hwnd )
472 return DestroyWindow( WIN_Handle32(hwnd) );
476 /*******************************************************************
477 * EnumWindows (USER.54)
479 BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam )
481 struct wnd_enum_info info;
485 return EnumWindows( wnd_enum_callback, (LPARAM)&info );
489 /**********************************************************************
490 * EnumChildWindows (USER.55)
492 BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam )
494 struct wnd_enum_info info;
498 return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info );
502 /**************************************************************************
503 * MoveWindow (USER.56)
505 BOOL16 WINAPI MoveWindow16( HWND16 hwnd, INT16 x, INT16 y, INT16 cx, INT16 cy, BOOL16 repaint )
507 return MoveWindow( WIN_Handle32(hwnd), x, y, cx, cy, repaint );
511 /***********************************************************************
512 * RegisterClass (USER.57)
514 ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
518 wcex.cbSize = sizeof(wcex);
519 wcex.style = wc->style;
520 wcex.lpfnWndProc = wc->lpfnWndProc;
521 wcex.cbClsExtra = wc->cbClsExtra;
522 wcex.cbWndExtra = wc->cbWndExtra;
523 wcex.hInstance = wc->hInstance;
524 wcex.hIcon = wc->hIcon;
525 wcex.hCursor = wc->hCursor;
526 wcex.hbrBackground = wc->hbrBackground;
527 wcex.lpszMenuName = wc->lpszMenuName;
528 wcex.lpszClassName = wc->lpszClassName;
530 return RegisterClassEx16( &wcex );
534 /**************************************************************************
535 * GetClassName (USER.58)
537 INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
539 return GetClassNameA( WIN_Handle32(hwnd), buffer, count );
543 /**************************************************************************
544 * SetActiveWindow (USER.59)
546 HWND16 WINAPI SetActiveWindow16( HWND16 hwnd )
548 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd) ));
552 /**************************************************************************
553 * GetActiveWindow (USER.60)
555 HWND16 WINAPI GetActiveWindow16(void)
557 return HWND_16( GetActiveWindow() );
561 /**************************************************************************
562 * ScrollWindow (USER.61)
564 void WINAPI ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect,
565 const RECT16 *clipRect )
567 RECT rect32, clipRect32;
571 rect32.left = rect->left;
572 rect32.top = rect->top;
573 rect32.right = rect->right;
574 rect32.bottom = rect->bottom;
578 clipRect32.left = clipRect->left;
579 clipRect32.top = clipRect->top;
580 clipRect32.right = clipRect->right;
581 clipRect32.bottom = clipRect->bottom;
583 ScrollWindow( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
584 clipRect ? &clipRect32 : NULL );
588 /**************************************************************************
589 * SetScrollPos (USER.62)
591 INT16 WINAPI SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 redraw )
593 return SetScrollPos( WIN_Handle32(hwnd), nBar, nPos, redraw );
597 /**************************************************************************
598 * GetScrollPos (USER.63)
600 INT16 WINAPI GetScrollPos16( HWND16 hwnd, INT16 nBar )
602 return GetScrollPos( WIN_Handle32(hwnd), nBar );
606 /**************************************************************************
607 * SetScrollRange (USER.64)
609 void WINAPI SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal, BOOL16 redraw )
611 /* Invalid range -> range is set to (0,0) */
612 if ((INT)MaxVal - (INT)MinVal > 0x7fff) MinVal = MaxVal = 0;
613 SetScrollRange( WIN_Handle32(hwnd), nBar, MinVal, MaxVal, redraw );
617 /**************************************************************************
618 * GetScrollRange (USER.65)
620 BOOL16 WINAPI GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
623 BOOL ret = GetScrollRange( WIN_Handle32(hwnd), nBar, &min, &max );
624 if (lpMin) *lpMin = min;
625 if (lpMax) *lpMax = max;
630 /**************************************************************************
633 HDC16 WINAPI GetDC16( HWND16 hwnd )
635 return HDC_16(GetDC( WIN_Handle32(hwnd) ));
639 /**************************************************************************
640 * GetWindowDC (USER.67)
642 HDC16 WINAPI GetWindowDC16( HWND16 hwnd )
644 return GetDCEx16( hwnd, 0, DCX_USESTYLE | DCX_WINDOW );
648 /**************************************************************************
649 * ReleaseDC (USER.68)
651 INT16 WINAPI ReleaseDC16( HWND16 hwnd, HDC16 hdc )
653 return (INT16)ReleaseDC( WIN_Handle32(hwnd), HDC_32(hdc) );
657 /**************************************************************************
658 * FlashWindow (USER.105)
660 BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
662 return FlashWindow( WIN_Handle32(hwnd), bInvert );
666 /**************************************************************************
667 * WindowFromDC (USER.117)
669 HWND16 WINAPI WindowFromDC16( HDC16 hDC )
671 return HWND_16( WindowFromDC( HDC_32(hDC) ) );
675 /**************************************************************************
676 * UpdateWindow (USER.124)
678 void WINAPI UpdateWindow16( HWND16 hwnd )
680 RedrawWindow16( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
684 /**************************************************************************
685 * InvalidateRect (USER.125)
687 void WINAPI InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
689 RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
693 /**************************************************************************
694 * InvalidateRgn (USER.126)
696 void WINAPI InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
698 RedrawWindow16( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
702 /**************************************************************************
703 * ValidateRect (USER.127)
705 void WINAPI ValidateRect16( HWND16 hwnd, const RECT16 *rect )
707 RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
711 /**************************************************************************
712 * ValidateRgn (USER.128)
714 void WINAPI ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
716 RedrawWindow16( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
720 /**************************************************************************
721 * GetClassWord (USER.129)
723 WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
725 return GetClassWord( WIN_Handle32(hwnd), offset );
729 /**************************************************************************
730 * SetClassWord (USER.130)
732 WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
734 return SetClassWord( WIN_Handle32(hwnd), offset, newval );
738 /***********************************************************************
739 * GetClassLong (USER.131)
741 LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
743 LONG_PTR ret = GetClassLongA( WIN_Handle32(hwnd16), offset );
748 return (LONG_PTR)WINPROC_GetProc16( (WNDPROC)ret, FALSE );
750 return MapLS( (void *)ret ); /* leak */
757 /***********************************************************************
758 * SetClassLong (USER.132)
760 LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
766 WNDPROC new_proc = WINPROC_AllocProc16( (WNDPROC16)newval );
767 WNDPROC old_proc = (WNDPROC)SetClassLongA( WIN_Handle32(hwnd16), offset, (LONG_PTR)new_proc );
768 return (LONG)WINPROC_GetProc16( old_proc, FALSE );
771 newval = (LONG)MapSL( newval );
774 return SetClassLongA( WIN_Handle32(hwnd16), offset, newval );
779 /**************************************************************************
780 * GetWindowWord (USER.133)
782 WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
784 return GetWindowWord( WIN_Handle32(hwnd), offset );
788 /**************************************************************************
789 * SetWindowWord (USER.134)
791 WORD WINAPI SetWindowWord16( HWND16 hwnd, INT16 offset, WORD newval )
793 return SetWindowWord( WIN_Handle32(hwnd), offset, newval );
797 /**********************************************************************
798 * GetWindowLong (USER.135)
800 LONG WINAPI GetWindowLong16( HWND16 hwnd, INT16 offset )
804 BOOL is_winproc = (offset == GWLP_WNDPROC);
808 if (!(wndPtr = WIN_GetPtr( WIN_Handle32(hwnd) )))
810 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
813 if (wndPtr != WND_OTHER_PROCESS && wndPtr != WND_DESKTOP)
815 if (offset > (int)(wndPtr->cbWndExtra - sizeof(LONG)))
818 * Some programs try to access last element from 16 bit
819 * code using illegal offset value. Hopefully this is
820 * what those programs really expect.
822 if (wndPtr->cbWndExtra >= 4 && offset == wndPtr->cbWndExtra - sizeof(WORD))
824 offset = wndPtr->cbWndExtra - sizeof(LONG);
828 WIN_ReleasePtr( wndPtr );
829 SetLastError( ERROR_INVALID_INDEX );
833 is_winproc = ((offset == DWLP_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG));
834 WIN_ReleasePtr( wndPtr );
837 retvalue = GetWindowLongA( WIN_Handle32(hwnd), offset );
838 if (is_winproc) retvalue = (LONG_PTR)WINPROC_GetProc16( (WNDPROC)retvalue, FALSE );
843 /**********************************************************************
844 * SetWindowLong (USER.136)
846 LONG WINAPI SetWindowLong16( HWND16 hwnd, INT16 offset, LONG newval )
849 BOOL is_winproc = (offset == GWLP_WNDPROC);
851 if (offset == DWLP_DLGPROC)
853 if (!(wndPtr = WIN_GetPtr( WIN_Handle32(hwnd) )))
855 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
858 if (wndPtr != WND_OTHER_PROCESS && wndPtr != WND_DESKTOP)
860 is_winproc = ((wndPtr->cbWndExtra - sizeof(LONG_PTR) >= DWLP_DLGPROC) &&
861 (wndPtr->flags & WIN_ISDIALOG));
862 WIN_ReleasePtr( wndPtr );
868 WNDPROC new_proc = WINPROC_AllocProc16( (WNDPROC16)newval );
869 WNDPROC old_proc = (WNDPROC)SetWindowLongPtrA( WIN_Handle32(hwnd), offset, (LONG_PTR)new_proc );
870 return (LONG)WINPROC_GetProc16( old_proc, FALSE );
872 else return SetWindowLongA( WIN_Handle32(hwnd), offset, newval );
876 /**************************************************************************
877 * OpenClipboard (USER.137)
879 BOOL16 WINAPI OpenClipboard16( HWND16 hwnd )
881 return OpenClipboard( WIN_Handle32(hwnd) );
885 /**************************************************************************
886 * GetClipboardOwner (USER.140)
888 HWND16 WINAPI GetClipboardOwner16(void)
890 return HWND_16( GetClipboardOwner() );
894 /**************************************************************************
895 * SetClipboardViewer (USER.147)
897 HWND16 WINAPI SetClipboardViewer16( HWND16 hwnd )
899 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd) ));
903 /**************************************************************************
904 * GetClipboardViewer (USER.148)
906 HWND16 WINAPI GetClipboardViewer16(void)
908 return HWND_16( GetClipboardViewer() );
912 /**************************************************************************
913 * ChangeClipboardChain (USER.149)
915 BOOL16 WINAPI ChangeClipboardChain16(HWND16 hwnd, HWND16 hwndNext)
917 return ChangeClipboardChain( WIN_Handle32(hwnd), WIN_Handle32(hwndNext) );
921 /**************************************************************************
922 * GetSystemMenu (USER.156)
924 HMENU16 WINAPI GetSystemMenu16( HWND16 hwnd, BOOL16 revert )
926 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd), revert ));
930 /**************************************************************************
933 HMENU16 WINAPI GetMenu16( HWND16 hwnd )
935 return HMENU_16(GetMenu( WIN_Handle32(hwnd) ));
939 /**************************************************************************
942 BOOL16 WINAPI SetMenu16( HWND16 hwnd, HMENU16 hMenu )
944 return SetMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
948 /**************************************************************************
949 * DrawMenuBar (USER.160)
951 void WINAPI DrawMenuBar16( HWND16 hwnd )
953 DrawMenuBar( WIN_Handle32(hwnd) );
957 /**************************************************************************
958 * HiliteMenuItem (USER.162)
960 BOOL16 WINAPI HiliteMenuItem16( HWND16 hwnd, HMENU16 hMenu, UINT16 id, UINT16 wHilite )
962 return HiliteMenuItem( WIN_Handle32(hwnd), HMENU_32(hMenu), id, wHilite );
966 /**************************************************************************
967 * CreateCaret (USER.163)
969 void WINAPI CreateCaret16( HWND16 hwnd, HBITMAP16 bitmap, INT16 width, INT16 height )
971 CreateCaret( WIN_Handle32(hwnd), HBITMAP_32(bitmap), width, height );
975 /*****************************************************************
976 * DestroyCaret (USER.164)
978 void WINAPI DestroyCaret16(void)
984 /*****************************************************************
985 * SetCaretPos (USER.165)
987 void WINAPI SetCaretPos16( INT16 x, INT16 y )
993 /**************************************************************************
994 * HideCaret (USER.166)
996 void WINAPI HideCaret16( HWND16 hwnd )
998 HideCaret( WIN_Handle32(hwnd) );
1002 /**************************************************************************
1003 * ShowCaret (USER.167)
1005 void WINAPI ShowCaret16( HWND16 hwnd )
1007 ShowCaret( WIN_Handle32(hwnd) );
1011 /*****************************************************************
1012 * SetCaretBlinkTime (USER.168)
1014 void WINAPI SetCaretBlinkTime16( UINT16 msecs )
1016 SetCaretBlinkTime( msecs );
1020 /*****************************************************************
1021 * GetCaretBlinkTime (USER.169)
1023 UINT16 WINAPI GetCaretBlinkTime16(void)
1025 return GetCaretBlinkTime();
1029 /**************************************************************************
1030 * ArrangeIconicWindows (USER.170)
1032 UINT16 WINAPI ArrangeIconicWindows16( HWND16 parent)
1034 return ArrangeIconicWindows( WIN_Handle32(parent) );
1038 /**************************************************************************
1039 * SwitchToThisWindow (USER.172)
1041 void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
1043 SwitchToThisWindow( WIN_Handle32(hwnd), restore );
1047 /**************************************************************************
1048 * KillSystemTimer (USER.182)
1050 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
1052 return KillSystemTimer( WIN_Handle32(hwnd), id );
1056 /*****************************************************************
1057 * GetCaretPos (USER.183)
1059 void WINAPI GetCaretPos16( LPPOINT16 pt16 )
1062 if (GetCaretPos( &pt ))
1070 /**************************************************************************
1071 * SetSysModalWindow (USER.188)
1073 HWND16 WINAPI SetSysModalWindow16( HWND16 hwnd )
1075 HWND16 old = hwndSysModal;
1076 hwndSysModal = hwnd;
1081 /**************************************************************************
1082 * GetSysModalWindow (USER.189)
1084 HWND16 WINAPI GetSysModalWindow16(void)
1086 return hwndSysModal;
1090 /**************************************************************************
1091 * GetUpdateRect (USER.190)
1093 BOOL16 WINAPI GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase )
1098 if (!rect) return GetUpdateRect( WIN_Handle32(hwnd), NULL, erase );
1099 ret = GetUpdateRect( WIN_Handle32(hwnd), &r, erase );
1100 rect->left = r.left;
1102 rect->right = r.right;
1103 rect->bottom = r.bottom;
1108 /**************************************************************************
1109 * ChildWindowFromPoint (USER.191)
1111 HWND16 WINAPI ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt )
1117 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent), pt32 ));
1121 /***********************************************************************
1122 * CascadeChildWindows (USER.198)
1124 void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
1126 CascadeWindows( WIN_Handle32(parent), action, NULL, 0, NULL );
1130 /***********************************************************************
1131 * TileChildWindows (USER.199)
1133 void WINAPI TileChildWindows16( HWND16 parent, WORD action )
1135 TileWindows( WIN_Handle32(parent), action, NULL, 0, NULL );
1139 /***********************************************************************
1140 * GetWindowTask (USER.224)
1142 HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
1144 DWORD tid = GetWindowThreadProcessId( HWND_32(hwnd), NULL );
1146 return HTASK_16(tid);
1149 /**********************************************************************
1150 * EnumTaskWindows (USER.225)
1152 BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam )
1154 struct wnd_enum_info info;
1155 DWORD tid = HTASK_32( hTask );
1157 if (!tid) return FALSE;
1159 info.param = lParam;
1160 return EnumThreadWindows( tid, wnd_enum_callback, (LPARAM)&info );
1164 /**************************************************************************
1165 * GetTopWindow (USER.229)
1167 HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
1169 return HWND_16( GetTopWindow( WIN_Handle32(hwnd) ));
1173 /**************************************************************************
1174 * GetNextWindow (USER.230)
1176 HWND16 WINAPI GetNextWindow16( HWND16 hwnd, WORD flag )
1178 if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
1179 return GetWindow16( hwnd, flag );
1183 /**************************************************************************
1184 * SetWindowPos (USER.232)
1186 BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
1187 INT16 x, INT16 y, INT16 cx, INT16 cy, WORD flags)
1189 return SetWindowPos( WIN_Handle32(hwnd), full_insert_after_hwnd(hwndInsertAfter),
1190 x, y, cx, cy, flags );
1194 /**************************************************************************
1195 * SetParent (USER.233)
1197 HWND16 WINAPI SetParent16( HWND16 hwndChild, HWND16 hwndNewParent )
1199 return HWND_16( SetParent( WIN_Handle32(hwndChild), WIN_Handle32(hwndNewParent) ));
1203 /**************************************************************************
1204 * GetCapture (USER.236)
1206 HWND16 WINAPI GetCapture16(void)
1208 return HWND_16( GetCapture() );
1212 /**************************************************************************
1213 * GetUpdateRgn (USER.237)
1215 INT16 WINAPI GetUpdateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
1217 return GetUpdateRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), erase );
1221 /**************************************************************************
1222 * ExcludeUpdateRgn (USER.238)
1224 INT16 WINAPI ExcludeUpdateRgn16( HDC16 hdc, HWND16 hwnd )
1226 return ExcludeUpdateRgn( HDC_32(hdc), WIN_Handle32(hwnd) );
1230 /**************************************************************************
1231 * GetOpenClipboardWindow (USER.248)
1233 HWND16 WINAPI GetOpenClipboardWindow16(void)
1235 return HWND_16( GetOpenClipboardWindow() );
1239 /**************************************************************************
1240 * BeginDeferWindowPos (USER.259)
1242 HDWP16 WINAPI BeginDeferWindowPos16( INT16 count )
1244 return HDWP_16(BeginDeferWindowPos( count ));
1248 /**************************************************************************
1249 * DeferWindowPos (USER.260)
1251 HDWP16 WINAPI DeferWindowPos16( HDWP16 hdwp, HWND16 hwnd, HWND16 hwndAfter,
1252 INT16 x, INT16 y, INT16 cx, INT16 cy,
1255 return HDWP_16(DeferWindowPos( HDWP_32(hdwp), WIN_Handle32(hwnd),
1256 full_insert_after_hwnd(hwndAfter), x, y, cx, cy, flags ));
1260 /**************************************************************************
1261 * EndDeferWindowPos (USER.261)
1263 BOOL16 WINAPI EndDeferWindowPos16( HDWP16 hdwp )
1265 return EndDeferWindowPos(HDWP_32(hdwp));
1269 /**************************************************************************
1270 * GetWindow (USER.262)
1272 HWND16 WINAPI GetWindow16( HWND16 hwnd, WORD rel )
1274 return HWND_16( GetWindow( WIN_Handle32(hwnd), rel ) );
1278 /**************************************************************************
1279 * ShowOwnedPopups (USER.265)
1281 void WINAPI ShowOwnedPopups16( HWND16 owner, BOOL16 fShow )
1283 ShowOwnedPopups( WIN_Handle32(owner), fShow );
1287 /**************************************************************************
1288 * ShowScrollBar (USER.267)
1290 void WINAPI ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
1292 ShowScrollBar( WIN_Handle32(hwnd), nBar, fShow );
1296 /**************************************************************************
1297 * IsZoomed (USER.272)
1299 BOOL16 WINAPI IsZoomed16(HWND16 hwnd)
1301 return IsZoomed( WIN_Handle32(hwnd) );
1305 /**************************************************************************
1306 * GetDlgCtrlID (USER.277)
1308 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1310 return GetDlgCtrlID( WIN_Handle32(hwnd) );
1314 /**************************************************************************
1315 * GetDesktopHwnd (USER.278)
1317 * Exactly the same thing as GetDesktopWindow(), but not documented.
1318 * Don't ask me why...
1320 HWND16 WINAPI GetDesktopHwnd16(void)
1322 return GetDesktopWindow16();
1326 /**************************************************************************
1327 * SetSystemMenu (USER.280)
1329 BOOL16 WINAPI SetSystemMenu16( HWND16 hwnd, HMENU16 hMenu )
1331 return SetSystemMenu( WIN_Handle32(hwnd), HMENU_32(hMenu) );
1335 /**************************************************************************
1336 * GetDesktopWindow (USER.286)
1338 HWND16 WINAPI GetDesktopWindow16(void)
1340 return HWND_16( GetDesktopWindow() );
1344 /**************************************************************************
1345 * GetLastActivePopup (USER.287)
1347 HWND16 WINAPI GetLastActivePopup16( HWND16 hwnd )
1349 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd) ));
1353 /**************************************************************************
1354 * RedrawWindow (USER.290)
1356 BOOL16 WINAPI RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
1357 HRGN16 hrgnUpdate, UINT16 flags )
1362 r.left = rectUpdate->left;
1363 r.top = rectUpdate->top;
1364 r.right = rectUpdate->right;
1365 r.bottom = rectUpdate->bottom;
1366 return RedrawWindow(WIN_Handle32(hwnd), &r, HRGN_32(hrgnUpdate), flags);
1368 return RedrawWindow(WIN_Handle32(hwnd), NULL, HRGN_32(hrgnUpdate), flags);
1372 /**************************************************************************
1373 * LockWindowUpdate (USER.294)
1375 BOOL16 WINAPI LockWindowUpdate16( HWND16 hwnd )
1377 return LockWindowUpdate( WIN_Handle32(hwnd) );
1381 /**************************************************************************
1382 * ScrollWindowEx (USER.319)
1384 INT16 WINAPI ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy,
1385 const RECT16 *rect, const RECT16 *clipRect,
1386 HRGN16 hrgnUpdate, LPRECT16 rcUpdate,
1389 RECT rect32, clipRect32, rcUpdate32;
1394 rect32.left = rect->left;
1395 rect32.top = rect->top;
1396 rect32.right = rect->right;
1397 rect32.bottom = rect->bottom;
1401 clipRect32.left = clipRect->left;
1402 clipRect32.top = clipRect->top;
1403 clipRect32.right = clipRect->right;
1404 clipRect32.bottom = clipRect->bottom;
1406 ret = ScrollWindowEx( WIN_Handle32(hwnd), dx, dy, rect ? &rect32 : NULL,
1407 clipRect ? &clipRect32 : NULL, HRGN_32(hrgnUpdate),
1408 (rcUpdate) ? &rcUpdate32 : NULL, flags );
1411 rcUpdate->left = rcUpdate32.left;
1412 rcUpdate->top = rcUpdate32.top;
1413 rcUpdate->right = rcUpdate32.right;
1414 rcUpdate->bottom = rcUpdate32.bottom;
1420 /**************************************************************************
1421 * FillWindow (USER.324)
1423 void WINAPI FillWindow16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush )
1427 GetClientRect( WIN_Handle32(hwnd), &rect );
1428 DPtoLP( HDC_32(hdc), (LPPOINT)&rect, 2 );
1429 rc16.left = rect.left;
1430 rc16.top = rect.top;
1431 rc16.right = rect.right;
1432 rc16.bottom = rect.bottom;
1433 PaintRect16( hwndParent, hwnd, hdc, hbrush, &rc16 );
1437 /**************************************************************************
1438 * PaintRect (USER.325)
1440 void WINAPI PaintRect16( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc,
1441 HBRUSH16 hbrush, const RECT16 *rect)
1443 if (hbrush <= CTLCOLOR_STATIC)
1445 HWND parent = WIN_Handle32(hwndParent), hwnd32 = WIN_Handle32(hwnd);
1447 if (!parent) return;
1448 hbrush = SendMessageW( parent, WM_CTLCOLORMSGBOX + hbrush, (WPARAM)hdc, (LPARAM)hwnd32 );
1449 if (!hbrush) hbrush = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + hbrush,
1450 (WPARAM)hdc, (LPARAM)hwnd32 );
1452 if (hbrush) FillRect16( hdc, rect, hbrush );
1456 /**************************************************************************
1457 * GetControlBrush (USER.326)
1459 HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
1462 HWND hwnd32 = WIN_Handle32(hwnd);
1463 HWND parent = GetParent( hwnd32 );
1465 if (!parent) parent = hwnd32;
1466 ret = SendMessageW( parent, WM_CTLCOLORMSGBOX + ctlType, (WPARAM)hdc, (LPARAM)hwnd32 );
1467 if (!ret) ret = DefWindowProcW( parent, WM_CTLCOLORMSGBOX + ctlType,
1468 (WPARAM)hdc, (LPARAM)hwnd32 );
1473 /**************************************************************************
1474 * GetDCEx (USER.359)
1476 HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
1478 return HDC_16(GetDCEx(WIN_Handle32(hwnd), HRGN_32(hrgnClip), flags));
1482 /**************************************************************************
1483 * GetWindowPlacement (USER.370)
1485 BOOL16 WINAPI GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wp16 )
1487 WINDOWPLACEMENT wpl;
1489 wpl.length = sizeof(wpl);
1490 if (!GetWindowPlacement( WIN_Handle32(hwnd), &wpl )) return FALSE;
1491 wp16->length = sizeof(*wp16);
1492 wp16->flags = wpl.flags;
1493 wp16->showCmd = wpl.showCmd;
1494 wp16->ptMinPosition.x = wpl.ptMinPosition.x;
1495 wp16->ptMinPosition.y = wpl.ptMinPosition.y;
1496 wp16->ptMaxPosition.x = wpl.ptMaxPosition.x;
1497 wp16->ptMaxPosition.y = wpl.ptMaxPosition.y;
1498 wp16->rcNormalPosition.left = wpl.rcNormalPosition.left;
1499 wp16->rcNormalPosition.top = wpl.rcNormalPosition.top;
1500 wp16->rcNormalPosition.right = wpl.rcNormalPosition.right;
1501 wp16->rcNormalPosition.bottom = wpl.rcNormalPosition.bottom;
1506 /**************************************************************************
1507 * SetWindowPlacement (USER.371)
1509 BOOL16 WINAPI SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wp16 )
1511 WINDOWPLACEMENT wpl;
1513 if (!wp16) return FALSE;
1514 wpl.length = sizeof(wpl);
1515 wpl.flags = wp16->flags;
1516 wpl.showCmd = wp16->showCmd;
1517 wpl.ptMinPosition.x = wp16->ptMinPosition.x;
1518 wpl.ptMinPosition.y = wp16->ptMinPosition.y;
1519 wpl.ptMaxPosition.x = wp16->ptMaxPosition.x;
1520 wpl.ptMaxPosition.y = wp16->ptMaxPosition.y;
1521 wpl.rcNormalPosition.left = wp16->rcNormalPosition.left;
1522 wpl.rcNormalPosition.top = wp16->rcNormalPosition.top;
1523 wpl.rcNormalPosition.right = wp16->rcNormalPosition.right;
1524 wpl.rcNormalPosition.bottom = wp16->rcNormalPosition.bottom;
1525 return SetWindowPlacement( WIN_Handle32(hwnd), &wpl );
1529 /***********************************************************************
1530 * RegisterClassEx (USER.397)
1532 ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
1536 wc32.cbSize = sizeof(wc32);
1537 wc32.style = wc->style;
1538 wc32.lpfnWndProc = WINPROC_AllocProc16( wc->lpfnWndProc );
1539 wc32.cbClsExtra = wc->cbClsExtra;
1540 wc32.cbWndExtra = wc->cbWndExtra;
1541 wc32.hInstance = HINSTANCE_32(GetExePtr(wc->hInstance));
1542 if (!wc32.hInstance) wc32.hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
1543 wc32.hIcon = HICON_32(wc->hIcon);
1544 wc32.hCursor = HCURSOR_32(wc->hCursor);
1545 wc32.hbrBackground = HBRUSH_32(wc->hbrBackground);
1546 wc32.lpszMenuName = MapSL(wc->lpszMenuName);
1547 wc32.lpszClassName = MapSL(wc->lpszClassName);
1548 wc32.hIconSm = HICON_32(wc->hIconSm);
1549 return RegisterClassExA( &wc32 );
1553 /***********************************************************************
1554 * GetClassInfoEx (USER.398)
1556 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1557 * same in Win16 as in Win32. --AJ
1559 BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
1562 HINSTANCE hInstance;
1565 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1566 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
1568 ret = GetClassInfoExA( hInstance, MapSL(name), &wc32 );
1572 wc->lpfnWndProc = WINPROC_GetProc16( wc32.lpfnWndProc, FALSE );
1573 wc->style = wc32.style;
1574 wc->cbClsExtra = wc32.cbClsExtra;
1575 wc->cbWndExtra = wc32.cbWndExtra;
1576 wc->hInstance = (wc32.hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(wc32.hInstance);
1577 wc->hIcon = HICON_16(wc32.hIcon);
1578 wc->hIconSm = HICON_16(wc32.hIconSm);
1579 wc->hCursor = HCURSOR_16(wc32.hCursor);
1580 wc->hbrBackground = HBRUSH_16(wc32.hbrBackground);
1581 wc->lpszClassName = 0;
1582 wc->lpszMenuName = MapLS(wc32.lpszMenuName); /* FIXME: leak */
1588 /**************************************************************************
1589 * ChildWindowFromPointEx (USER.399)
1591 HWND16 WINAPI ChildWindowFromPointEx16( HWND16 hwndParent, POINT16 pt, UINT16 uFlags)
1597 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent), pt32, uFlags ));
1601 /**************************************************************************
1602 * GetPriorityClipboardFormat (USER.402)
1604 INT16 WINAPI GetPriorityClipboardFormat16( UINT16 *list, INT16 count )
1608 for (i = 0; i < count; i++)
1609 if (IsClipboardFormatAvailable( list[i] )) return list[i];
1614 /***********************************************************************
1615 * UnregisterClass (USER.403)
1617 BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
1619 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
1620 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
1624 /***********************************************************************
1625 * GetClassInfo (USER.404)
1627 BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
1630 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
1634 wc->style = wcex.style;
1635 wc->lpfnWndProc = wcex.lpfnWndProc;
1636 wc->cbClsExtra = wcex.cbClsExtra;
1637 wc->cbWndExtra = wcex.cbWndExtra;
1638 wc->hInstance = wcex.hInstance;
1639 wc->hIcon = wcex.hIcon;
1640 wc->hCursor = wcex.hCursor;
1641 wc->hbrBackground = wcex.hbrBackground;
1642 wc->lpszMenuName = wcex.lpszMenuName;
1643 wc->lpszClassName = wcex.lpszClassName;
1649 /**************************************************************************
1650 * TrackPopupMenu (USER.416)
1652 BOOL16 WINAPI TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
1653 INT16 nReserved, HWND16 hwnd, const RECT16 *lpRect )
1658 r.left = lpRect->left;
1659 r.top = lpRect->top;
1660 r.right = lpRect->right;
1661 r.bottom = lpRect->bottom;
1663 return TrackPopupMenu( HMENU_32(hMenu), wFlags, x, y, nReserved,
1664 WIN_Handle32(hwnd), lpRect ? &r : NULL );
1668 /**************************************************************************
1669 * FindWindowEx (USER.427)
1671 HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
1673 return HWND_16( FindWindowExA( WIN_Handle32(parent), WIN_Handle32(child),
1674 className, title ));
1678 /***********************************************************************
1679 * DefFrameProc (USER.445)
1681 LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient,
1682 UINT16 message, WPARAM16 wParam, LPARAM lParam )
1687 lParam = (LPARAM)MapSL(lParam);
1693 return DefFrameProcA( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1694 message, wParam, lParam );
1698 MDINEXTMENU next_menu;
1699 DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient),
1700 message, wParam, (LPARAM)&next_menu );
1701 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1704 return DefWindowProc16(hwnd, message, wParam, lParam);
1709 /***********************************************************************
1710 * DefMDIChildProc (USER.447)
1712 LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message,
1713 WPARAM16 wParam, LPARAM lParam )
1718 return DefMDIChildProcA( WIN_Handle32(hwnd), message, wParam, (LPARAM)MapSL(lParam) );
1723 case WM_CHILDACTIVATE:
1728 return DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, lParam );
1730 case WM_GETMINMAXINFO:
1732 MINMAXINFO16 *mmi16 = MapSL(lParam);
1735 mmi.ptReserved.x = mmi16->ptReserved.x;
1736 mmi.ptReserved.y = mmi16->ptReserved.y;
1737 mmi.ptMaxSize.x = mmi16->ptMaxSize.x;
1738 mmi.ptMaxSize.y = mmi16->ptMaxSize.y;
1739 mmi.ptMaxPosition.x = mmi16->ptMaxPosition.x;
1740 mmi.ptMaxPosition.y = mmi16->ptMaxPosition.y;
1741 mmi.ptMinTrackSize.x = mmi16->ptMinTrackSize.x;
1742 mmi.ptMinTrackSize.y = mmi16->ptMinTrackSize.y;
1743 mmi.ptMaxTrackSize.x = mmi16->ptMaxTrackSize.x;
1744 mmi.ptMaxTrackSize.y = mmi16->ptMaxTrackSize.y;
1746 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&mmi );
1748 mmi16->ptReserved.x = mmi.ptReserved.x;
1749 mmi16->ptReserved.y = mmi.ptReserved.y;
1750 mmi16->ptMaxSize.x = mmi.ptMaxSize.x;
1751 mmi16->ptMaxSize.y = mmi.ptMaxSize.y;
1752 mmi16->ptMaxPosition.x = mmi.ptMaxPosition.x;
1753 mmi16->ptMaxPosition.y = mmi.ptMaxPosition.y;
1754 mmi16->ptMinTrackSize.x = mmi.ptMinTrackSize.x;
1755 mmi16->ptMinTrackSize.y = mmi.ptMinTrackSize.y;
1756 mmi16->ptMaxTrackSize.x = mmi.ptMaxTrackSize.x;
1757 mmi16->ptMaxTrackSize.y = mmi.ptMaxTrackSize.y;
1762 MDINEXTMENU next_menu;
1763 DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu );
1764 return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) );
1767 return DefWindowProc16(hwnd, message, wParam, lParam);
1772 /**************************************************************************
1773 * DrawAnimatedRects (USER.448)
1775 BOOL16 WINAPI DrawAnimatedRects16( HWND16 hwnd, INT16 idAni,
1776 const RECT16* lprcFrom, const RECT16* lprcTo )
1778 RECT rcFrom32, rcTo32;
1779 rcFrom32.left = lprcFrom->left;
1780 rcFrom32.top = lprcFrom->top;
1781 rcFrom32.right = lprcFrom->right;
1782 rcFrom32.bottom = lprcFrom->bottom;
1783 rcTo32.left = lprcTo->left;
1784 rcTo32.top = lprcTo->top;
1785 rcTo32.right = lprcTo->right;
1786 rcTo32.bottom = lprcTo->bottom;
1787 return DrawAnimatedRects( WIN_Handle32(hwnd), idAni, &rcFrom32, &rcTo32 );
1791 /***********************************************************************
1792 * GetInternalWindowPos (USER.460)
1794 UINT16 WINAPI GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd, LPPOINT16 ptIcon )
1796 WINDOWPLACEMENT16 wndpl;
1798 if (!GetWindowPlacement16( hwnd, &wndpl )) return 0;
1799 if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
1800 if (ptIcon) *ptIcon = wndpl.ptMinPosition;
1801 return wndpl.showCmd;
1805 /**************************************************************************
1806 * SetInternalWindowPos (USER.461)
1808 void WINAPI SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, LPRECT16 rect, LPPOINT16 pt )
1815 rc32.left = rect->left;
1816 rc32.top = rect->top;
1817 rc32.right = rect->right;
1818 rc32.bottom = rect->bottom;
1825 SetInternalWindowPos( WIN_Handle32(hwnd), showCmd,
1826 rect ? &rc32 : NULL, pt ? &pt32 : NULL );
1830 /**************************************************************************
1831 * CalcChildScroll (USER.462)
1833 void WINAPI CalcChildScroll16( HWND16 hwnd, WORD scroll )
1835 CalcChildScroll( WIN_Handle32(hwnd), scroll );
1839 /**************************************************************************
1840 * ScrollChildren (USER.463)
1842 void WINAPI ScrollChildren16(HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam)
1844 ScrollChildren( WIN_Handle32(hwnd), uMsg, wParam, lParam );
1848 /**************************************************************************
1849 * DragDetect (USER.465)
1851 BOOL16 WINAPI DragDetect16( HWND16 hwnd, POINT16 pt )
1857 return DragDetect( WIN_Handle32(hwnd), pt32 );
1861 /**************************************************************************
1862 * SetScrollInfo (USER.475)
1864 INT16 WINAPI SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info, BOOL16 redraw )
1866 return SetScrollInfo( WIN_Handle32(hwnd), nBar, info, redraw );
1870 /**************************************************************************
1871 * GetScrollInfo (USER.476)
1873 BOOL16 WINAPI GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
1875 return GetScrollInfo( WIN_Handle32(hwnd), nBar, info );
1879 /**************************************************************************
1880 * EnableScrollBar (USER.482)
1882 BOOL16 WINAPI EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
1884 return EnableScrollBar( WIN_Handle32(hwnd), nBar, flags );
1888 /**************************************************************************
1889 * GetShellWindow (USER.600)
1891 HWND16 WINAPI GetShellWindow16(void)
1893 return HWND_16( GetShellWindow() );
1897 /**************************************************************************
1898 * GetForegroundWindow (USER.608)
1900 HWND16 WINAPI GetForegroundWindow16(void)
1902 return HWND_16( GetForegroundWindow() );
1906 /**************************************************************************
1907 * SetForegroundWindow (USER.609)
1909 BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
1911 return SetForegroundWindow( WIN_Handle32(hwnd) );
1915 /**************************************************************************
1916 * DrawCaptionTemp (USER.657)
1918 BOOL16 WINAPI DrawCaptionTemp16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect,
1919 HFONT16 hFont, HICON16 hIcon, LPCSTR str, UINT16 uFlags )
1925 rect32.left = rect->left;
1926 rect32.top = rect->top;
1927 rect32.right = rect->right;
1928 rect32.bottom = rect->bottom;
1930 return DrawCaptionTempA( WIN_Handle32(hwnd), HDC_32(hdc),
1931 rect ? &rect32 : NULL, HFONT_32(hFont),
1932 HICON_32(hIcon), str, uFlags & 0x1f );
1936 /**************************************************************************
1937 * DrawCaption (USER.660)
1939 BOOL16 WINAPI DrawCaption16( HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 flags )
1945 rect32.left = rect->left;
1946 rect32.top = rect->top;
1947 rect32.right = rect->right;
1948 rect32.bottom = rect->bottom;
1950 return DrawCaption(WIN_Handle32(hwnd), HDC_32(hdc), rect ? &rect32 : NULL, flags);
1954 /**************************************************************************
1955 * GetMenuItemRect (USER.665)
1957 BOOL16 WINAPI GetMenuItemRect16( HWND16 hwnd, HMENU16 hMenu, UINT16 uItem,
1962 if (!rect) return FALSE;
1963 res = GetMenuItemRect( WIN_Handle32(hwnd), HMENU_32(hMenu), uItem, &r32 );
1964 rect->left = r32.left;
1965 rect->top = r32.top;
1966 rect->right = r32.right;
1967 rect->bottom = r32.bottom;
1972 /**************************************************************************
1973 * SetWindowRgn (USER.668)
1975 INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 redraw )
1977 return SetWindowRgn( WIN_Handle32(hwnd), HRGN_32(hrgn), redraw );
1981 /**************************************************************************
1982 * MessageBoxIndirect (USER.827)
1984 INT16 WINAPI MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox )
1986 MSGBOXPARAMSA msgbox32;
1988 msgbox32.cbSize = msgbox->cbSize;
1989 msgbox32.hwndOwner = WIN_Handle32( msgbox->hwndOwner );
1990 msgbox32.hInstance = HINSTANCE_32(msgbox->hInstance);
1991 msgbox32.lpszText = MapSL(msgbox->lpszText);
1992 msgbox32.lpszCaption = MapSL(msgbox->lpszCaption);
1993 msgbox32.dwStyle = msgbox->dwStyle;
1994 msgbox32.lpszIcon = MapSL(msgbox->lpszIcon);
1995 msgbox32.dwContextHelpId = msgbox->dwContextHelpId;
1996 msgbox32.lpfnMsgBoxCallback = msgbox->lpfnMsgBoxCallback;
1997 msgbox32.dwLanguageId = msgbox->dwLanguageId;
1998 return MessageBoxIndirectA( &msgbox32 );