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"
25 #include "user_private.h"
26 #include "wine/list.h"
27 #include "wine/server.h"
29 /* size of buffer needed to store an atom string */
30 #define ATOM_BUFFER_SIZE 256
32 /* handle <--> handle16 conversions */
33 #define HANDLE_16(h32) (LOWORD(h32))
34 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
36 static HWND16 hwndSysModal
;
45 static struct list class_list
= LIST_INIT( class_list
);
53 /* callback for 16-bit window enumeration functions */
54 static BOOL CALLBACK
wnd_enum_callback( HWND hwnd
, LPARAM param
)
56 const struct wnd_enum_info
*info
= (struct wnd_enum_info
*)param
;
60 args
[2] = HWND_16(hwnd
);
61 args
[1] = HIWORD(info
->param
);
62 args
[0] = LOWORD(info
->param
);
63 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
67 /* convert insert after window handle to 32-bit */
68 static inline HWND
full_insert_after_hwnd( HWND16 hwnd
)
70 HWND ret
= WIN_Handle32( hwnd
);
71 if (ret
== (HWND
)0xffff) ret
= HWND_TOPMOST
;
75 void free_module_classes( HINSTANCE16 inst
)
77 struct class_entry
*class, *next
;
79 LIST_FOR_EACH_ENTRY_SAFE( class, next
, &class_list
, struct class_entry
, entry
)
81 if (class->inst
!= inst
) continue;
82 list_remove( &class->entry
);
83 UnregisterClassA( (LPCSTR
)MAKEINTATOM(class->atom
), HINSTANCE_32(class->inst
) );
84 HeapFree( GetProcessHeap(), 0, class );
88 /**************************************************************************
91 INT16 WINAPI
MessageBox16( HWND16 hwnd
, LPCSTR text
, LPCSTR title
, UINT16 type
)
93 return MessageBoxA( WIN_Handle32(hwnd
), text
, title
, type
);
97 /***********************************************************************
100 UINT16 WINAPI
SetTimer16( HWND16 hwnd
, UINT16 id
, UINT16 timeout
, TIMERPROC16 proc
)
102 TIMERPROC proc32
= (TIMERPROC
)WINPROC_AllocProc16( (WNDPROC16
)proc
);
103 return SetTimer( WIN_Handle32(hwnd
), id
, timeout
, proc32
);
107 /***********************************************************************
108 * SetSystemTimer (USER.11)
110 UINT16 WINAPI
SetSystemTimer16( HWND16 hwnd
, UINT16 id
, UINT16 timeout
, TIMERPROC16 proc
)
112 TIMERPROC proc32
= (TIMERPROC
)WINPROC_AllocProc16( (WNDPROC16
)proc
);
113 return SetSystemTimer( WIN_Handle32(hwnd
), id
, timeout
, proc32
);
117 /**************************************************************************
118 * KillTimer (USER.12)
120 BOOL16 WINAPI
KillTimer16( HWND16 hwnd
, UINT16 id
)
122 return KillTimer( WIN_Handle32(hwnd
), id
);
126 /**************************************************************************
127 * SetCapture (USER.18)
129 HWND16 WINAPI
SetCapture16( HWND16 hwnd
)
131 return HWND_16( SetCapture( WIN_Handle32(hwnd
) ));
135 /**************************************************************************
136 * ReleaseCapture (USER.19)
138 BOOL16 WINAPI
ReleaseCapture16(void)
140 return ReleaseCapture();
144 /**************************************************************************
147 HWND16 WINAPI
SetFocus16( HWND16 hwnd
)
149 return HWND_16( SetFocus( WIN_Handle32(hwnd
) ));
153 /**************************************************************************
156 HWND16 WINAPI
GetFocus16(void)
158 return HWND_16( GetFocus() );
162 /**************************************************************************
163 * RemoveProp (USER.24)
165 HANDLE16 WINAPI
RemoveProp16( HWND16 hwnd
, LPCSTR str
)
167 return HANDLE_16(RemovePropA( WIN_Handle32(hwnd
), str
));
171 /**************************************************************************
174 HANDLE16 WINAPI
GetProp16( HWND16 hwnd
, LPCSTR str
)
176 return HANDLE_16(GetPropA( WIN_Handle32(hwnd
), str
));
180 /**************************************************************************
183 BOOL16 WINAPI
SetProp16( HWND16 hwnd
, LPCSTR str
, HANDLE16 handle
)
185 return SetPropA( WIN_Handle32(hwnd
), str
, HANDLE_32(handle
) );
189 /***********************************************************************
190 * EnumProps (USER.27)
192 INT16 WINAPI
EnumProps16( HWND16 hwnd
, PROPENUMPROC16 func
)
194 int ret
= -1, i
, count
, total
= 32;
195 property_data_t
*list
;
199 if (!(list
= HeapAlloc( GetProcessHeap(), 0, total
* sizeof(*list
) ))) break;
201 SERVER_START_REQ( get_window_properties
)
203 req
->window
= wine_server_user_handle( HWND_32(hwnd
) );
204 wine_server_set_reply( req
, list
, total
* sizeof(*list
) );
205 if (!wine_server_call( req
)) count
= reply
->total
;
209 if (count
&& count
<= total
)
211 char string
[ATOM_BUFFER_SIZE
];
212 SEGPTR segptr
= MapLS( string
);
216 for (i
= 0; i
< count
; i
++)
218 if (list
[i
].string
) /* it was a string originally */
220 if (!GlobalGetAtomNameA( list
[i
].atom
, string
, ATOM_BUFFER_SIZE
)) continue;
222 args
[2] = SELECTOROF(segptr
);
223 args
[1] = OFFSETOF(segptr
);
224 args
[0] = LOWORD(list
[i
].data
);
230 args
[1] = list
[i
].atom
;
231 args
[0] = LOWORD(list
[i
].data
);
233 WOWCallback16Ex( (DWORD
)func
, WCB16_PASCAL
, sizeof(args
), args
, &result
);
234 if (!(ret
= LOWORD(result
))) break;
237 HeapFree( GetProcessHeap(), 0, list
);
240 HeapFree( GetProcessHeap(), 0, list
);
241 total
= count
; /* restart with larger buffer */
247 /**************************************************************************
248 * ClientToScreen (USER.28)
250 void WINAPI
ClientToScreen16( HWND16 hwnd
, LPPOINT16 lppnt
)
252 MapWindowPoints16( hwnd
, 0, lppnt
, 1 );
256 /**************************************************************************
257 * ScreenToClient (USER.29)
259 void WINAPI
ScreenToClient16( HWND16 hwnd
, LPPOINT16 lppnt
)
261 MapWindowPoints16( 0, hwnd
, lppnt
, 1 );
265 /**************************************************************************
266 * WindowFromPoint (USER.30)
268 HWND16 WINAPI
WindowFromPoint16( POINT16 pt
)
274 return HWND_16( WindowFromPoint( pt32
) );
278 /**************************************************************************
281 BOOL16 WINAPI
IsIconic16(HWND16 hwnd
)
283 return IsIconic( WIN_Handle32(hwnd
) );
287 /**************************************************************************
288 * GetWindowRect (USER.32)
290 void WINAPI
GetWindowRect16( HWND16 hwnd
, LPRECT16 rect
)
294 GetWindowRect( WIN_Handle32(hwnd
), &rect32
);
295 rect
->left
= rect32
.left
;
296 rect
->top
= rect32
.top
;
297 rect
->right
= rect32
.right
;
298 rect
->bottom
= rect32
.bottom
;
302 /**************************************************************************
303 * GetClientRect (USER.33)
305 void WINAPI
GetClientRect16( HWND16 hwnd
, LPRECT16 rect
)
309 GetClientRect( WIN_Handle32(hwnd
), &rect32
);
310 rect
->left
= rect32
.left
;
311 rect
->top
= rect32
.top
;
312 rect
->right
= rect32
.right
;
313 rect
->bottom
= rect32
.bottom
;
317 /**************************************************************************
318 * EnableWindow (USER.34)
320 BOOL16 WINAPI
EnableWindow16( HWND16 hwnd
, BOOL16 enable
)
322 return EnableWindow( WIN_Handle32(hwnd
), enable
);
326 /**************************************************************************
327 * IsWindowEnabled (USER.35)
329 BOOL16 WINAPI
IsWindowEnabled16(HWND16 hwnd
)
331 return IsWindowEnabled( WIN_Handle32(hwnd
) );
335 /**************************************************************************
336 * GetWindowText (USER.36)
338 INT16 WINAPI
GetWindowText16( HWND16 hwnd
, SEGPTR lpString
, INT16 nMaxCount
)
340 return SendMessage16( hwnd
, WM_GETTEXT
, nMaxCount
, lpString
);
344 /**************************************************************************
345 * SetWindowText (USER.37)
347 BOOL16 WINAPI
SetWindowText16( HWND16 hwnd
, SEGPTR lpString
)
349 return SendMessage16( hwnd
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
353 /**************************************************************************
354 * GetWindowTextLength (USER.38)
356 INT16 WINAPI
GetWindowTextLength16( HWND16 hwnd
)
358 return SendMessage16( hwnd
, WM_GETTEXTLENGTH
, 0, 0 );
362 /***********************************************************************
363 * BeginPaint (USER.39)
365 HDC16 WINAPI
BeginPaint16( HWND16 hwnd
, LPPAINTSTRUCT16 lps
)
369 BeginPaint( WIN_Handle32(hwnd
), &ps
);
370 lps
->hdc
= HDC_16(ps
.hdc
);
371 lps
->fErase
= ps
.fErase
;
372 lps
->rcPaint
.top
= ps
.rcPaint
.top
;
373 lps
->rcPaint
.left
= ps
.rcPaint
.left
;
374 lps
->rcPaint
.right
= ps
.rcPaint
.right
;
375 lps
->rcPaint
.bottom
= ps
.rcPaint
.bottom
;
376 lps
->fRestore
= ps
.fRestore
;
377 lps
->fIncUpdate
= ps
.fIncUpdate
;
382 /***********************************************************************
385 BOOL16 WINAPI
EndPaint16( HWND16 hwnd
, const PAINTSTRUCT16
* lps
)
389 ps
.hdc
= HDC_32(lps
->hdc
);
390 return EndPaint( WIN_Handle32(hwnd
), &ps
);
394 /***********************************************************************
395 * CreateWindow (USER.41)
397 HWND16 WINAPI
CreateWindow16( LPCSTR className
, LPCSTR windowName
,
398 DWORD style
, INT16 x
, INT16 y
, INT16 width
,
399 INT16 height
, HWND16 parent
, HMENU16 menu
,
400 HINSTANCE16 instance
, LPVOID data
)
402 return CreateWindowEx16( 0, className
, windowName
, style
,
403 x
, y
, width
, height
, parent
, menu
, instance
, data
);
407 /**************************************************************************
408 * ShowWindow (USER.42)
410 BOOL16 WINAPI
ShowWindow16( HWND16 hwnd
, INT16 cmd
)
412 return ShowWindow( WIN_Handle32(hwnd
), cmd
);
416 /**************************************************************************
417 * CloseWindow (USER.43)
419 BOOL16 WINAPI
CloseWindow16( HWND16 hwnd
)
421 return CloseWindow( WIN_Handle32(hwnd
) );
425 /**************************************************************************
428 BOOL16 WINAPI
OpenIcon16( HWND16 hwnd
)
430 return OpenIcon( WIN_Handle32(hwnd
) );
434 /**************************************************************************
435 * BringWindowToTop (USER.45)
437 BOOL16 WINAPI
BringWindowToTop16( HWND16 hwnd
)
439 return BringWindowToTop( WIN_Handle32(hwnd
) );
443 /**************************************************************************
444 * GetParent (USER.46)
446 HWND16 WINAPI
GetParent16( HWND16 hwnd
)
448 return HWND_16( GetParent( WIN_Handle32(hwnd
) ));
452 /**************************************************************************
455 BOOL16 WINAPI
IsWindow16( HWND16 hwnd
)
457 STACK16FRAME
*frame
= MapSL( (SEGPTR
)NtCurrentTeb()->WOW32Reserved
);
458 frame
->es
= USER_HeapSel
;
459 /* don't use WIN_Handle32 here, we don't care about the full handle */
460 return IsWindow( HWND_32(hwnd
) );
464 /**************************************************************************
467 BOOL16 WINAPI
IsChild16( HWND16 parent
, HWND16 child
)
469 return IsChild( WIN_Handle32(parent
), WIN_Handle32(child
) );
473 /**************************************************************************
474 * IsWindowVisible (USER.49)
476 BOOL16 WINAPI
IsWindowVisible16( HWND16 hwnd
)
478 return IsWindowVisible( WIN_Handle32(hwnd
) );
482 /**************************************************************************
483 * FindWindow (USER.50)
485 HWND16 WINAPI
FindWindow16( LPCSTR className
, LPCSTR title
)
487 return HWND_16( FindWindowA( className
, title
));
491 /**************************************************************************
492 * DestroyWindow (USER.53)
494 BOOL16 WINAPI
DestroyWindow16( HWND16 hwnd
)
496 return DestroyWindow( WIN_Handle32(hwnd
) );
500 /*******************************************************************
501 * EnumWindows (USER.54)
503 BOOL16 WINAPI
EnumWindows16( WNDENUMPROC16 func
, LPARAM lParam
)
505 struct wnd_enum_info info
;
509 return EnumWindows( wnd_enum_callback
, (LPARAM
)&info
);
513 /**********************************************************************
514 * EnumChildWindows (USER.55)
516 BOOL16 WINAPI
EnumChildWindows16( HWND16 parent
, WNDENUMPROC16 func
, LPARAM lParam
)
518 struct wnd_enum_info info
;
522 return EnumChildWindows( WIN_Handle32(parent
), wnd_enum_callback
, (LPARAM
)&info
);
526 /**************************************************************************
527 * MoveWindow (USER.56)
529 BOOL16 WINAPI
MoveWindow16( HWND16 hwnd
, INT16 x
, INT16 y
, INT16 cx
, INT16 cy
, BOOL16 repaint
)
531 return MoveWindow( WIN_Handle32(hwnd
), x
, y
, cx
, cy
, repaint
);
535 /***********************************************************************
536 * RegisterClass (USER.57)
538 ATOM WINAPI
RegisterClass16( const WNDCLASS16
*wc
)
542 wcex
.cbSize
= sizeof(wcex
);
543 wcex
.style
= wc
->style
;
544 wcex
.lpfnWndProc
= wc
->lpfnWndProc
;
545 wcex
.cbClsExtra
= wc
->cbClsExtra
;
546 wcex
.cbWndExtra
= wc
->cbWndExtra
;
547 wcex
.hInstance
= wc
->hInstance
;
548 wcex
.hIcon
= wc
->hIcon
;
549 wcex
.hCursor
= wc
->hCursor
;
550 wcex
.hbrBackground
= wc
->hbrBackground
;
551 wcex
.lpszMenuName
= wc
->lpszMenuName
;
552 wcex
.lpszClassName
= wc
->lpszClassName
;
554 return RegisterClassEx16( &wcex
);
558 /**************************************************************************
559 * GetClassName (USER.58)
561 INT16 WINAPI
GetClassName16( HWND16 hwnd
, LPSTR buffer
, INT16 count
)
563 return GetClassNameA( WIN_Handle32(hwnd
), buffer
, count
);
567 /**************************************************************************
568 * SetActiveWindow (USER.59)
570 HWND16 WINAPI
SetActiveWindow16( HWND16 hwnd
)
572 return HWND_16( SetActiveWindow( WIN_Handle32(hwnd
) ));
576 /**************************************************************************
577 * GetActiveWindow (USER.60)
579 HWND16 WINAPI
GetActiveWindow16(void)
581 return HWND_16( GetActiveWindow() );
585 /**************************************************************************
586 * ScrollWindow (USER.61)
588 void WINAPI
ScrollWindow16( HWND16 hwnd
, INT16 dx
, INT16 dy
, const RECT16
*rect
,
589 const RECT16
*clipRect
)
591 RECT rect32
, clipRect32
;
595 rect32
.left
= rect
->left
;
596 rect32
.top
= rect
->top
;
597 rect32
.right
= rect
->right
;
598 rect32
.bottom
= rect
->bottom
;
602 clipRect32
.left
= clipRect
->left
;
603 clipRect32
.top
= clipRect
->top
;
604 clipRect32
.right
= clipRect
->right
;
605 clipRect32
.bottom
= clipRect
->bottom
;
607 ScrollWindow( WIN_Handle32(hwnd
), dx
, dy
, rect
? &rect32
: NULL
,
608 clipRect
? &clipRect32
: NULL
);
612 /**************************************************************************
613 * SetScrollPos (USER.62)
615 INT16 WINAPI
SetScrollPos16( HWND16 hwnd
, INT16 nBar
, INT16 nPos
, BOOL16 redraw
)
617 return SetScrollPos( WIN_Handle32(hwnd
), nBar
, nPos
, redraw
);
621 /**************************************************************************
622 * GetScrollPos (USER.63)
624 INT16 WINAPI
GetScrollPos16( HWND16 hwnd
, INT16 nBar
)
626 return GetScrollPos( WIN_Handle32(hwnd
), nBar
);
630 /**************************************************************************
631 * SetScrollRange (USER.64)
633 void WINAPI
SetScrollRange16( HWND16 hwnd
, INT16 nBar
, INT16 MinVal
, INT16 MaxVal
, BOOL16 redraw
)
635 /* Invalid range -> range is set to (0,0) */
636 if ((INT
)MaxVal
- (INT
)MinVal
> 0x7fff) MinVal
= MaxVal
= 0;
637 SetScrollRange( WIN_Handle32(hwnd
), nBar
, MinVal
, MaxVal
, redraw
);
641 /**************************************************************************
642 * GetScrollRange (USER.65)
644 BOOL16 WINAPI
GetScrollRange16( HWND16 hwnd
, INT16 nBar
, LPINT16 lpMin
, LPINT16 lpMax
)
647 BOOL ret
= GetScrollRange( WIN_Handle32(hwnd
), nBar
, &min
, &max
);
648 if (lpMin
) *lpMin
= min
;
649 if (lpMax
) *lpMax
= max
;
654 /**************************************************************************
657 HDC16 WINAPI
GetDC16( HWND16 hwnd
)
659 return HDC_16(GetDC( WIN_Handle32(hwnd
) ));
663 /**************************************************************************
664 * GetWindowDC (USER.67)
666 HDC16 WINAPI
GetWindowDC16( HWND16 hwnd
)
668 return GetDCEx16( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
);
672 /**************************************************************************
673 * ReleaseDC (USER.68)
675 INT16 WINAPI
ReleaseDC16( HWND16 hwnd
, HDC16 hdc
)
677 return (INT16
)ReleaseDC( WIN_Handle32(hwnd
), HDC_32(hdc
) );
681 /**************************************************************************
682 * FlashWindow (USER.105)
684 BOOL16 WINAPI
FlashWindow16( HWND16 hwnd
, BOOL16 bInvert
)
686 return FlashWindow( WIN_Handle32(hwnd
), bInvert
);
690 /**************************************************************************
691 * WindowFromDC (USER.117)
693 HWND16 WINAPI
WindowFromDC16( HDC16 hDC
)
695 return HWND_16( WindowFromDC( HDC_32(hDC
) ) );
699 /**************************************************************************
700 * UpdateWindow (USER.124)
702 void WINAPI
UpdateWindow16( HWND16 hwnd
)
704 RedrawWindow16( hwnd
, NULL
, 0, RDW_UPDATENOW
| RDW_ALLCHILDREN
);
708 /**************************************************************************
709 * InvalidateRect (USER.125)
711 void WINAPI
InvalidateRect16( HWND16 hwnd
, const RECT16
*rect
, BOOL16 erase
)
713 RedrawWindow16( hwnd
, rect
, 0, RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0) );
717 /**************************************************************************
718 * InvalidateRgn (USER.126)
720 void WINAPI
InvalidateRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 erase
)
722 RedrawWindow16( hwnd
, NULL
, hrgn
, RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0) );
726 /**************************************************************************
727 * ValidateRect (USER.127)
729 void WINAPI
ValidateRect16( HWND16 hwnd
, const RECT16
*rect
)
731 RedrawWindow16( hwnd
, rect
, 0, RDW_VALIDATE
| RDW_NOCHILDREN
);
735 /**************************************************************************
736 * ValidateRgn (USER.128)
738 void WINAPI
ValidateRgn16( HWND16 hwnd
, HRGN16 hrgn
)
740 RedrawWindow16( hwnd
, NULL
, hrgn
, RDW_VALIDATE
| RDW_NOCHILDREN
);
744 /**************************************************************************
745 * GetClassWord (USER.129)
747 WORD WINAPI
GetClassWord16( HWND16 hwnd
, INT16 offset
)
749 return GetClassWord( WIN_Handle32(hwnd
), offset
);
753 /**************************************************************************
754 * SetClassWord (USER.130)
756 WORD WINAPI
SetClassWord16( HWND16 hwnd
, INT16 offset
, WORD newval
)
758 return SetClassWord( WIN_Handle32(hwnd
), offset
, newval
);
762 /***********************************************************************
763 * GetClassLong (USER.131)
765 LONG WINAPI
GetClassLong16( HWND16 hwnd16
, INT16 offset
)
767 LONG_PTR ret
= GetClassLongA( WIN_Handle32(hwnd16
), offset
);
772 return (LONG_PTR
)WINPROC_GetProc16( (WNDPROC
)ret
, FALSE
);
774 return MapLS( (void *)ret
); /* leak */
781 /***********************************************************************
782 * SetClassLong (USER.132)
784 LONG WINAPI
SetClassLong16( HWND16 hwnd16
, INT16 offset
, LONG newval
)
790 WNDPROC new_proc
= WINPROC_AllocProc16( (WNDPROC16
)newval
);
791 WNDPROC old_proc
= (WNDPROC
)SetClassLongA( WIN_Handle32(hwnd16
), offset
, (LONG_PTR
)new_proc
);
792 return (LONG
)WINPROC_GetProc16( old_proc
, FALSE
);
795 newval
= (LONG
)MapSL( newval
);
798 return SetClassLongA( WIN_Handle32(hwnd16
), offset
, newval
);
803 /**************************************************************************
804 * GetWindowWord (USER.133)
806 WORD WINAPI
GetWindowWord16( HWND16 hwnd
, INT16 offset
)
808 return GetWindowWord( WIN_Handle32(hwnd
), offset
);
812 /**************************************************************************
813 * SetWindowWord (USER.134)
815 WORD WINAPI
SetWindowWord16( HWND16 hwnd
, INT16 offset
, WORD newval
)
817 return SetWindowWord( WIN_Handle32(hwnd
), offset
, newval
);
821 /**********************************************************************
822 * GetWindowLong (USER.135)
824 LONG WINAPI
GetWindowLong16( HWND16 hwnd16
, INT16 offset
)
826 HWND hwnd
= WIN_Handle32( hwnd16
);
828 BOOL is_winproc
= (offset
== GWLP_WNDPROC
);
832 int cbWndExtra
= GetClassLongA( hwnd
, GCL_CBWNDEXTRA
);
834 if (offset
> (int)(cbWndExtra
- sizeof(LONG
)))
837 * Some programs try to access last element from 16 bit
838 * code using illegal offset value. Hopefully this is
839 * what those programs really expect.
841 if (cbWndExtra
>= 4 && offset
== cbWndExtra
- sizeof(WORD
))
843 offset
= cbWndExtra
- sizeof(LONG
);
847 SetLastError( ERROR_INVALID_INDEX
);
851 else if (offset
== DWLP_DLGPROC
)
852 is_winproc
= (wow_handlers32
.get_dialog_info( hwnd
, FALSE
) != NULL
);
854 retvalue
= GetWindowLongA( hwnd
, offset
);
855 if (is_winproc
) retvalue
= (LONG_PTR
)WINPROC_GetProc16( (WNDPROC
)retvalue
, FALSE
);
860 /**********************************************************************
861 * SetWindowLong (USER.136)
863 LONG WINAPI
SetWindowLong16( HWND16 hwnd16
, INT16 offset
, LONG newval
)
865 HWND hwnd
= WIN_Handle32( hwnd16
);
866 BOOL is_winproc
= (offset
== GWLP_WNDPROC
);
868 if (offset
== DWLP_DLGPROC
)
869 is_winproc
= (wow_handlers32
.get_dialog_info( hwnd
, FALSE
) != NULL
);
873 WNDPROC new_proc
= WINPROC_AllocProc16( (WNDPROC16
)newval
);
874 WNDPROC old_proc
= (WNDPROC
)SetWindowLongPtrA( hwnd
, offset
, (LONG_PTR
)new_proc
);
875 return (LONG
)WINPROC_GetProc16( old_proc
, FALSE
);
877 else return SetWindowLongA( hwnd
, offset
, newval
);
881 /**************************************************************************
882 * OpenClipboard (USER.137)
884 BOOL16 WINAPI
OpenClipboard16( HWND16 hwnd
)
886 return OpenClipboard( WIN_Handle32(hwnd
) );
890 /**************************************************************************
891 * GetClipboardOwner (USER.140)
893 HWND16 WINAPI
GetClipboardOwner16(void)
895 return HWND_16( GetClipboardOwner() );
899 /**************************************************************************
900 * SetClipboardViewer (USER.147)
902 HWND16 WINAPI
SetClipboardViewer16( HWND16 hwnd
)
904 return HWND_16( SetClipboardViewer( WIN_Handle32(hwnd
) ));
908 /**************************************************************************
909 * GetClipboardViewer (USER.148)
911 HWND16 WINAPI
GetClipboardViewer16(void)
913 return HWND_16( GetClipboardViewer() );
917 /**************************************************************************
918 * ChangeClipboardChain (USER.149)
920 BOOL16 WINAPI
ChangeClipboardChain16(HWND16 hwnd
, HWND16 hwndNext
)
922 return ChangeClipboardChain( WIN_Handle32(hwnd
), WIN_Handle32(hwndNext
) );
926 /**************************************************************************
927 * GetSystemMenu (USER.156)
929 HMENU16 WINAPI
GetSystemMenu16( HWND16 hwnd
, BOOL16 revert
)
931 return HMENU_16(GetSystemMenu( WIN_Handle32(hwnd
), revert
));
935 /**************************************************************************
938 HMENU16 WINAPI
GetMenu16( HWND16 hwnd
)
940 return HMENU_16(GetMenu( WIN_Handle32(hwnd
) ));
944 /**************************************************************************
947 BOOL16 WINAPI
SetMenu16( HWND16 hwnd
, HMENU16 hMenu
)
949 return SetMenu( WIN_Handle32(hwnd
), HMENU_32(hMenu
) );
953 /**************************************************************************
954 * DrawMenuBar (USER.160)
956 void WINAPI
DrawMenuBar16( HWND16 hwnd
)
958 DrawMenuBar( WIN_Handle32(hwnd
) );
962 /**************************************************************************
963 * HiliteMenuItem (USER.162)
965 BOOL16 WINAPI
HiliteMenuItem16( HWND16 hwnd
, HMENU16 hMenu
, UINT16 id
, UINT16 wHilite
)
967 return HiliteMenuItem( WIN_Handle32(hwnd
), HMENU_32(hMenu
), id
, wHilite
);
971 /**************************************************************************
972 * CreateCaret (USER.163)
974 void WINAPI
CreateCaret16( HWND16 hwnd
, HBITMAP16 bitmap
, INT16 width
, INT16 height
)
976 CreateCaret( WIN_Handle32(hwnd
), HBITMAP_32(bitmap
), width
, height
);
980 /*****************************************************************
981 * DestroyCaret (USER.164)
983 void WINAPI
DestroyCaret16(void)
989 /*****************************************************************
990 * SetCaretPos (USER.165)
992 void WINAPI
SetCaretPos16( INT16 x
, INT16 y
)
998 /**************************************************************************
999 * HideCaret (USER.166)
1001 void WINAPI
HideCaret16( HWND16 hwnd
)
1003 HideCaret( WIN_Handle32(hwnd
) );
1007 /**************************************************************************
1008 * ShowCaret (USER.167)
1010 void WINAPI
ShowCaret16( HWND16 hwnd
)
1012 ShowCaret( WIN_Handle32(hwnd
) );
1016 /*****************************************************************
1017 * SetCaretBlinkTime (USER.168)
1019 void WINAPI
SetCaretBlinkTime16( UINT16 msecs
)
1021 SetCaretBlinkTime( msecs
);
1025 /*****************************************************************
1026 * GetCaretBlinkTime (USER.169)
1028 UINT16 WINAPI
GetCaretBlinkTime16(void)
1030 return GetCaretBlinkTime();
1034 /**************************************************************************
1035 * ArrangeIconicWindows (USER.170)
1037 UINT16 WINAPI
ArrangeIconicWindows16( HWND16 parent
)
1039 return ArrangeIconicWindows( WIN_Handle32(parent
) );
1043 /**************************************************************************
1044 * SwitchToThisWindow (USER.172)
1046 void WINAPI
SwitchToThisWindow16( HWND16 hwnd
, BOOL16 restore
)
1048 SwitchToThisWindow( WIN_Handle32(hwnd
), restore
);
1052 /**************************************************************************
1053 * KillSystemTimer (USER.182)
1055 BOOL16 WINAPI
KillSystemTimer16( HWND16 hwnd
, UINT16 id
)
1057 return KillSystemTimer( WIN_Handle32(hwnd
), id
);
1061 /*****************************************************************
1062 * GetCaretPos (USER.183)
1064 void WINAPI
GetCaretPos16( LPPOINT16 pt16
)
1067 if (GetCaretPos( &pt
))
1075 /**************************************************************************
1076 * SetSysModalWindow (USER.188)
1078 HWND16 WINAPI
SetSysModalWindow16( HWND16 hwnd
)
1080 HWND16 old
= hwndSysModal
;
1081 hwndSysModal
= hwnd
;
1086 /**************************************************************************
1087 * GetSysModalWindow (USER.189)
1089 HWND16 WINAPI
GetSysModalWindow16(void)
1091 return hwndSysModal
;
1095 /**************************************************************************
1096 * GetUpdateRect (USER.190)
1098 BOOL16 WINAPI
GetUpdateRect16( HWND16 hwnd
, LPRECT16 rect
, BOOL16 erase
)
1103 if (!rect
) return GetUpdateRect( WIN_Handle32(hwnd
), NULL
, erase
);
1104 ret
= GetUpdateRect( WIN_Handle32(hwnd
), &r
, erase
);
1105 rect
->left
= r
.left
;
1107 rect
->right
= r
.right
;
1108 rect
->bottom
= r
.bottom
;
1113 /**************************************************************************
1114 * ChildWindowFromPoint (USER.191)
1116 HWND16 WINAPI
ChildWindowFromPoint16( HWND16 hwndParent
, POINT16 pt
)
1122 return HWND_16( ChildWindowFromPoint( WIN_Handle32(hwndParent
), pt32
));
1126 /***********************************************************************
1127 * CascadeChildWindows (USER.198)
1129 void WINAPI
CascadeChildWindows16( HWND16 parent
, WORD action
)
1131 CascadeWindows( WIN_Handle32(parent
), action
, NULL
, 0, NULL
);
1135 /***********************************************************************
1136 * TileChildWindows (USER.199)
1138 void WINAPI
TileChildWindows16( HWND16 parent
, WORD action
)
1140 TileWindows( WIN_Handle32(parent
), action
, NULL
, 0, NULL
);
1144 /***********************************************************************
1145 * GetWindowTask (USER.224)
1147 HTASK16 WINAPI
GetWindowTask16( HWND16 hwnd
)
1149 DWORD tid
= GetWindowThreadProcessId( HWND_32(hwnd
), NULL
);
1151 return HTASK_16(tid
);
1154 /**********************************************************************
1155 * EnumTaskWindows (USER.225)
1157 BOOL16 WINAPI
EnumTaskWindows16( HTASK16 hTask
, WNDENUMPROC16 func
, LPARAM lParam
)
1159 struct wnd_enum_info info
;
1160 DWORD tid
= HTASK_32( hTask
);
1162 if (!tid
) return FALSE
;
1164 info
.param
= lParam
;
1165 return EnumThreadWindows( tid
, wnd_enum_callback
, (LPARAM
)&info
);
1169 /**************************************************************************
1170 * GetTopWindow (USER.229)
1172 HWND16 WINAPI
GetTopWindow16( HWND16 hwnd
)
1174 return HWND_16( GetTopWindow( WIN_Handle32(hwnd
) ));
1178 /**************************************************************************
1179 * GetNextWindow (USER.230)
1181 HWND16 WINAPI
GetNextWindow16( HWND16 hwnd
, WORD flag
)
1183 if ((flag
!= GW_HWNDNEXT
) && (flag
!= GW_HWNDPREV
)) return 0;
1184 return GetWindow16( hwnd
, flag
);
1188 /**************************************************************************
1189 * SetWindowPos (USER.232)
1191 BOOL16 WINAPI
SetWindowPos16( HWND16 hwnd
, HWND16 hwndInsertAfter
,
1192 INT16 x
, INT16 y
, INT16 cx
, INT16 cy
, WORD flags
)
1194 return SetWindowPos( WIN_Handle32(hwnd
), full_insert_after_hwnd(hwndInsertAfter
),
1195 x
, y
, cx
, cy
, flags
);
1199 /**************************************************************************
1200 * SetParent (USER.233)
1202 HWND16 WINAPI
SetParent16( HWND16 hwndChild
, HWND16 hwndNewParent
)
1204 return HWND_16( SetParent( WIN_Handle32(hwndChild
), WIN_Handle32(hwndNewParent
) ));
1208 /**************************************************************************
1209 * GetCapture (USER.236)
1211 HWND16 WINAPI
GetCapture16(void)
1213 return HWND_16( GetCapture() );
1217 /**************************************************************************
1218 * GetUpdateRgn (USER.237)
1220 INT16 WINAPI
GetUpdateRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 erase
)
1222 return GetUpdateRgn( WIN_Handle32(hwnd
), HRGN_32(hrgn
), erase
);
1226 /**************************************************************************
1227 * ExcludeUpdateRgn (USER.238)
1229 INT16 WINAPI
ExcludeUpdateRgn16( HDC16 hdc
, HWND16 hwnd
)
1231 return ExcludeUpdateRgn( HDC_32(hdc
), WIN_Handle32(hwnd
) );
1235 /**************************************************************************
1236 * GetOpenClipboardWindow (USER.248)
1238 HWND16 WINAPI
GetOpenClipboardWindow16(void)
1240 return HWND_16( GetOpenClipboardWindow() );
1244 /*******************************************************************
1245 * MapWindowPoints (USER.258)
1247 void WINAPI
MapWindowPoints16( HWND16 hwndFrom
, HWND16 hwndTo
, LPPOINT16 lppt
, UINT16 count
)
1249 POINT buffer
[8], *ppt
= buffer
;
1252 if (count
> 8) ppt
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(*ppt
) );
1253 for (i
= 0; i
< count
; i
++)
1255 ppt
[i
].x
= lppt
[i
].x
;
1256 ppt
[i
].y
= lppt
[i
].y
;
1258 MapWindowPoints( WIN_Handle32(hwndFrom
), WIN_Handle32(hwndTo
), ppt
, count
);
1259 for (i
= 0; i
< count
; i
++)
1261 lppt
[i
].x
= ppt
[i
].x
;
1262 lppt
[i
].y
= ppt
[i
].y
;
1264 if (ppt
!= buffer
) HeapFree( GetProcessHeap(), 0, ppt
);
1268 /**************************************************************************
1269 * BeginDeferWindowPos (USER.259)
1271 HDWP16 WINAPI
BeginDeferWindowPos16( INT16 count
)
1273 return HDWP_16(BeginDeferWindowPos( count
));
1277 /**************************************************************************
1278 * DeferWindowPos (USER.260)
1280 HDWP16 WINAPI
DeferWindowPos16( HDWP16 hdwp
, HWND16 hwnd
, HWND16 hwndAfter
,
1281 INT16 x
, INT16 y
, INT16 cx
, INT16 cy
,
1284 return HDWP_16(DeferWindowPos( HDWP_32(hdwp
), WIN_Handle32(hwnd
),
1285 full_insert_after_hwnd(hwndAfter
), x
, y
, cx
, cy
, flags
));
1289 /**************************************************************************
1290 * EndDeferWindowPos (USER.261)
1292 BOOL16 WINAPI
EndDeferWindowPos16( HDWP16 hdwp
)
1294 return EndDeferWindowPos(HDWP_32(hdwp
));
1298 /**************************************************************************
1299 * GetWindow (USER.262)
1301 HWND16 WINAPI
GetWindow16( HWND16 hwnd
, WORD rel
)
1303 return HWND_16( GetWindow( WIN_Handle32(hwnd
), rel
) );
1307 /**************************************************************************
1308 * ShowOwnedPopups (USER.265)
1310 void WINAPI
ShowOwnedPopups16( HWND16 owner
, BOOL16 fShow
)
1312 ShowOwnedPopups( WIN_Handle32(owner
), fShow
);
1316 /**************************************************************************
1317 * ShowScrollBar (USER.267)
1319 void WINAPI
ShowScrollBar16( HWND16 hwnd
, INT16 nBar
, BOOL16 fShow
)
1321 ShowScrollBar( WIN_Handle32(hwnd
), nBar
, fShow
);
1325 /**************************************************************************
1326 * IsZoomed (USER.272)
1328 BOOL16 WINAPI
IsZoomed16(HWND16 hwnd
)
1330 return IsZoomed( WIN_Handle32(hwnd
) );
1334 /**************************************************************************
1335 * GetDlgCtrlID (USER.277)
1337 INT16 WINAPI
GetDlgCtrlID16( HWND16 hwnd
)
1339 return GetDlgCtrlID( WIN_Handle32(hwnd
) );
1343 /**************************************************************************
1344 * GetDesktopHwnd (USER.278)
1346 * Exactly the same thing as GetDesktopWindow(), but not documented.
1347 * Don't ask me why...
1349 HWND16 WINAPI
GetDesktopHwnd16(void)
1351 return GetDesktopWindow16();
1355 /**************************************************************************
1356 * SetSystemMenu (USER.280)
1358 BOOL16 WINAPI
SetSystemMenu16( HWND16 hwnd
, HMENU16 hMenu
)
1360 return SetSystemMenu( WIN_Handle32(hwnd
), HMENU_32(hMenu
) );
1364 /**************************************************************************
1365 * GetDesktopWindow (USER.286)
1367 HWND16 WINAPI
GetDesktopWindow16(void)
1369 return HWND_16( GetDesktopWindow() );
1373 /**************************************************************************
1374 * GetLastActivePopup (USER.287)
1376 HWND16 WINAPI
GetLastActivePopup16( HWND16 hwnd
)
1378 return HWND_16( GetLastActivePopup( WIN_Handle32(hwnd
) ));
1382 /**************************************************************************
1383 * RedrawWindow (USER.290)
1385 BOOL16 WINAPI
RedrawWindow16( HWND16 hwnd
, const RECT16
*rectUpdate
,
1386 HRGN16 hrgnUpdate
, UINT16 flags
)
1391 r
.left
= rectUpdate
->left
;
1392 r
.top
= rectUpdate
->top
;
1393 r
.right
= rectUpdate
->right
;
1394 r
.bottom
= rectUpdate
->bottom
;
1395 return RedrawWindow(WIN_Handle32(hwnd
), &r
, HRGN_32(hrgnUpdate
), flags
);
1397 return RedrawWindow(WIN_Handle32(hwnd
), NULL
, HRGN_32(hrgnUpdate
), flags
);
1401 /**************************************************************************
1402 * LockWindowUpdate (USER.294)
1404 BOOL16 WINAPI
LockWindowUpdate16( HWND16 hwnd
)
1406 return LockWindowUpdate( WIN_Handle32(hwnd
) );
1410 /**************************************************************************
1411 * ScrollWindowEx (USER.319)
1413 INT16 WINAPI
ScrollWindowEx16( HWND16 hwnd
, INT16 dx
, INT16 dy
,
1414 const RECT16
*rect
, const RECT16
*clipRect
,
1415 HRGN16 hrgnUpdate
, LPRECT16 rcUpdate
,
1418 RECT rect32
, clipRect32
, rcUpdate32
;
1423 rect32
.left
= rect
->left
;
1424 rect32
.top
= rect
->top
;
1425 rect32
.right
= rect
->right
;
1426 rect32
.bottom
= rect
->bottom
;
1430 clipRect32
.left
= clipRect
->left
;
1431 clipRect32
.top
= clipRect
->top
;
1432 clipRect32
.right
= clipRect
->right
;
1433 clipRect32
.bottom
= clipRect
->bottom
;
1435 ret
= ScrollWindowEx( WIN_Handle32(hwnd
), dx
, dy
, rect
? &rect32
: NULL
,
1436 clipRect
? &clipRect32
: NULL
, HRGN_32(hrgnUpdate
),
1437 (rcUpdate
) ? &rcUpdate32
: NULL
, flags
);
1440 rcUpdate
->left
= rcUpdate32
.left
;
1441 rcUpdate
->top
= rcUpdate32
.top
;
1442 rcUpdate
->right
= rcUpdate32
.right
;
1443 rcUpdate
->bottom
= rcUpdate32
.bottom
;
1449 /**************************************************************************
1450 * FillWindow (USER.324)
1452 void WINAPI
FillWindow16( HWND16 hwndParent
, HWND16 hwnd
, HDC16 hdc
, HBRUSH16 hbrush
)
1456 GetClientRect( WIN_Handle32(hwnd
), &rect
);
1457 DPtoLP( HDC_32(hdc
), (LPPOINT
)&rect
, 2 );
1458 rc16
.left
= rect
.left
;
1459 rc16
.top
= rect
.top
;
1460 rc16
.right
= rect
.right
;
1461 rc16
.bottom
= rect
.bottom
;
1462 PaintRect16( hwndParent
, hwnd
, hdc
, hbrush
, &rc16
);
1466 /**************************************************************************
1467 * PaintRect (USER.325)
1469 void WINAPI
PaintRect16( HWND16 hwndParent
, HWND16 hwnd
, HDC16 hdc
,
1470 HBRUSH16 hbrush
, const RECT16
*rect
)
1472 if (hbrush
<= CTLCOLOR_STATIC
)
1474 HWND parent
= WIN_Handle32(hwndParent
), hwnd32
= WIN_Handle32(hwnd
);
1476 if (!parent
) return;
1477 hbrush
= SendMessageW( parent
, WM_CTLCOLORMSGBOX
+ hbrush
, (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1478 if (!hbrush
) hbrush
= DefWindowProcW( parent
, WM_CTLCOLORMSGBOX
+ hbrush
,
1479 (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1481 if (hbrush
) FillRect16( hdc
, rect
, hbrush
);
1485 /**************************************************************************
1486 * GetControlBrush (USER.326)
1488 HBRUSH16 WINAPI
GetControlBrush16( HWND16 hwnd
, HDC16 hdc
, UINT16 ctlType
)
1491 HWND hwnd32
= WIN_Handle32(hwnd
);
1492 HWND parent
= GetParent( hwnd32
);
1494 if (!parent
) parent
= hwnd32
;
1495 ret
= SendMessageW( parent
, WM_CTLCOLORMSGBOX
+ ctlType
, (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1496 if (!ret
) ret
= DefWindowProcW( parent
, WM_CTLCOLORMSGBOX
+ ctlType
,
1497 (WPARAM
)hdc
, (LPARAM
)hwnd32
);
1502 /**************************************************************************
1503 * GetDCEx (USER.359)
1505 HDC16 WINAPI
GetDCEx16( HWND16 hwnd
, HRGN16 hrgnClip
, DWORD flags
)
1507 return HDC_16(GetDCEx(WIN_Handle32(hwnd
), HRGN_32(hrgnClip
), flags
));
1511 /**************************************************************************
1512 * GetWindowPlacement (USER.370)
1514 BOOL16 WINAPI
GetWindowPlacement16( HWND16 hwnd
, WINDOWPLACEMENT16
*wp16
)
1516 WINDOWPLACEMENT wpl
;
1518 wpl
.length
= sizeof(wpl
);
1519 if (!GetWindowPlacement( WIN_Handle32(hwnd
), &wpl
)) return FALSE
;
1520 wp16
->length
= sizeof(*wp16
);
1521 wp16
->flags
= wpl
.flags
;
1522 wp16
->showCmd
= wpl
.showCmd
;
1523 wp16
->ptMinPosition
.x
= wpl
.ptMinPosition
.x
;
1524 wp16
->ptMinPosition
.y
= wpl
.ptMinPosition
.y
;
1525 wp16
->ptMaxPosition
.x
= wpl
.ptMaxPosition
.x
;
1526 wp16
->ptMaxPosition
.y
= wpl
.ptMaxPosition
.y
;
1527 wp16
->rcNormalPosition
.left
= wpl
.rcNormalPosition
.left
;
1528 wp16
->rcNormalPosition
.top
= wpl
.rcNormalPosition
.top
;
1529 wp16
->rcNormalPosition
.right
= wpl
.rcNormalPosition
.right
;
1530 wp16
->rcNormalPosition
.bottom
= wpl
.rcNormalPosition
.bottom
;
1535 /**************************************************************************
1536 * SetWindowPlacement (USER.371)
1538 BOOL16 WINAPI
SetWindowPlacement16( HWND16 hwnd
, const WINDOWPLACEMENT16
*wp16
)
1540 WINDOWPLACEMENT wpl
;
1542 if (!wp16
) return FALSE
;
1543 wpl
.length
= sizeof(wpl
);
1544 wpl
.flags
= wp16
->flags
;
1545 wpl
.showCmd
= wp16
->showCmd
;
1546 wpl
.ptMinPosition
.x
= wp16
->ptMinPosition
.x
;
1547 wpl
.ptMinPosition
.y
= wp16
->ptMinPosition
.y
;
1548 wpl
.ptMaxPosition
.x
= wp16
->ptMaxPosition
.x
;
1549 wpl
.ptMaxPosition
.y
= wp16
->ptMaxPosition
.y
;
1550 wpl
.rcNormalPosition
.left
= wp16
->rcNormalPosition
.left
;
1551 wpl
.rcNormalPosition
.top
= wp16
->rcNormalPosition
.top
;
1552 wpl
.rcNormalPosition
.right
= wp16
->rcNormalPosition
.right
;
1553 wpl
.rcNormalPosition
.bottom
= wp16
->rcNormalPosition
.bottom
;
1554 return SetWindowPlacement( WIN_Handle32(hwnd
), &wpl
);
1558 /***********************************************************************
1559 * RegisterClassEx (USER.397)
1561 ATOM WINAPI
RegisterClassEx16( const WNDCLASSEX16
*wc
)
1563 struct class_entry
*class;
1568 inst
= GetExePtr( wc
->hInstance
);
1569 if (!inst
) inst
= GetModuleHandle16( NULL
);
1571 wc32
.cbSize
= sizeof(wc32
);
1572 wc32
.style
= wc
->style
;
1573 wc32
.lpfnWndProc
= WINPROC_AllocProc16( wc
->lpfnWndProc
);
1574 wc32
.cbClsExtra
= wc
->cbClsExtra
;
1575 wc32
.cbWndExtra
= wc
->cbWndExtra
;
1576 wc32
.hInstance
= HINSTANCE_32(inst
);
1577 wc32
.hIcon
= HICON_32(wc
->hIcon
);
1578 wc32
.hCursor
= HCURSOR_32(wc
->hCursor
);
1579 wc32
.hbrBackground
= HBRUSH_32(wc
->hbrBackground
);
1580 wc32
.lpszMenuName
= MapSL(wc
->lpszMenuName
);
1581 wc32
.lpszClassName
= MapSL(wc
->lpszClassName
);
1582 wc32
.hIconSm
= HICON_32(wc
->hIconSm
);
1583 atom
= RegisterClassExA( &wc32
);
1584 if ((class = HeapAlloc( GetProcessHeap(), 0, sizeof(*class) )))
1588 list_add_tail( &class_list
, &class->entry
);
1594 /***********************************************************************
1595 * GetClassInfoEx (USER.398)
1597 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1598 * same in Win16 as in Win32. --AJ
1600 BOOL16 WINAPI
GetClassInfoEx16( HINSTANCE16 hInst16
, SEGPTR name
, WNDCLASSEX16
*wc
)
1603 HINSTANCE hInstance
;
1606 if (hInst16
== GetModuleHandle16("user")) hInstance
= user32_module
;
1607 else hInstance
= HINSTANCE_32(GetExePtr( hInst16
));
1609 ret
= GetClassInfoExA( hInstance
, MapSL(name
), &wc32
);
1613 wc
->lpfnWndProc
= WINPROC_GetProc16( wc32
.lpfnWndProc
, FALSE
);
1614 wc
->style
= wc32
.style
;
1615 wc
->cbClsExtra
= wc32
.cbClsExtra
;
1616 wc
->cbWndExtra
= wc32
.cbWndExtra
;
1617 wc
->hInstance
= (wc32
.hInstance
== user32_module
) ? GetModuleHandle16("user") : HINSTANCE_16(wc32
.hInstance
);
1618 wc
->hIcon
= HICON_16(wc32
.hIcon
);
1619 wc
->hIconSm
= HICON_16(wc32
.hIconSm
);
1620 wc
->hCursor
= HCURSOR_16(wc32
.hCursor
);
1621 wc
->hbrBackground
= HBRUSH_16(wc32
.hbrBackground
);
1622 wc
->lpszClassName
= 0;
1623 wc
->lpszMenuName
= MapLS(wc32
.lpszMenuName
); /* FIXME: leak */
1629 /**************************************************************************
1630 * ChildWindowFromPointEx (USER.399)
1632 HWND16 WINAPI
ChildWindowFromPointEx16( HWND16 hwndParent
, POINT16 pt
, UINT16 uFlags
)
1638 return HWND_16( ChildWindowFromPointEx( WIN_Handle32(hwndParent
), pt32
, uFlags
));
1642 /**************************************************************************
1643 * GetPriorityClipboardFormat (USER.402)
1645 INT16 WINAPI
GetPriorityClipboardFormat16( UINT16
*list
, INT16 count
)
1649 for (i
= 0; i
< count
; i
++)
1650 if (IsClipboardFormatAvailable( list
[i
] )) return list
[i
];
1655 /***********************************************************************
1656 * UnregisterClass (USER.403)
1658 BOOL16 WINAPI
UnregisterClass16( LPCSTR className
, HINSTANCE16 hInstance
)
1662 if (hInstance
== GetModuleHandle16("user")) hInstance
= 0;
1663 else hInstance
= GetExePtr( hInstance
);
1665 if ((atom
= GlobalFindAtomA( className
)))
1667 struct class_entry
*class;
1668 LIST_FOR_EACH_ENTRY( class, &class_list
, struct class_entry
, entry
)
1670 if (class->inst
!= hInstance
) continue;
1671 if (class->atom
!= atom
) continue;
1672 list_remove( &class->entry
);
1673 HeapFree( GetProcessHeap(), 0, class );
1677 return UnregisterClassA( className
, HINSTANCE_32(hInstance
) );
1681 /***********************************************************************
1682 * GetClassInfo (USER.404)
1684 BOOL16 WINAPI
GetClassInfo16( HINSTANCE16 hInst16
, SEGPTR name
, WNDCLASS16
*wc
)
1687 UINT16 ret
= GetClassInfoEx16( hInst16
, name
, &wcex
);
1691 wc
->style
= wcex
.style
;
1692 wc
->lpfnWndProc
= wcex
.lpfnWndProc
;
1693 wc
->cbClsExtra
= wcex
.cbClsExtra
;
1694 wc
->cbWndExtra
= wcex
.cbWndExtra
;
1695 wc
->hInstance
= wcex
.hInstance
;
1696 wc
->hIcon
= wcex
.hIcon
;
1697 wc
->hCursor
= wcex
.hCursor
;
1698 wc
->hbrBackground
= wcex
.hbrBackground
;
1699 wc
->lpszMenuName
= wcex
.lpszMenuName
;
1700 wc
->lpszClassName
= wcex
.lpszClassName
;
1706 /**************************************************************************
1707 * TrackPopupMenu (USER.416)
1709 BOOL16 WINAPI
TrackPopupMenu16( HMENU16 hMenu
, UINT16 wFlags
, INT16 x
, INT16 y
,
1710 INT16 nReserved
, HWND16 hwnd
, const RECT16
*lpRect
)
1715 r
.left
= lpRect
->left
;
1716 r
.top
= lpRect
->top
;
1717 r
.right
= lpRect
->right
;
1718 r
.bottom
= lpRect
->bottom
;
1720 return TrackPopupMenu( HMENU_32(hMenu
), wFlags
, x
, y
, nReserved
,
1721 WIN_Handle32(hwnd
), lpRect
? &r
: NULL
);
1725 /**************************************************************************
1726 * FindWindowEx (USER.427)
1728 HWND16 WINAPI
FindWindowEx16( HWND16 parent
, HWND16 child
, LPCSTR className
, LPCSTR title
)
1730 return HWND_16( FindWindowExA( WIN_Handle32(parent
), WIN_Handle32(child
),
1731 className
, title
));
1735 /***********************************************************************
1736 * DefFrameProc (USER.445)
1738 LRESULT WINAPI
DefFrameProc16( HWND16 hwnd
, HWND16 hwndMDIClient
,
1739 UINT16 message
, WPARAM16 wParam
, LPARAM lParam
)
1744 lParam
= (LPARAM
)MapSL(lParam
);
1750 return DefFrameProcA( WIN_Handle32(hwnd
), WIN_Handle32(hwndMDIClient
),
1751 message
, wParam
, lParam
);
1755 MDINEXTMENU next_menu
;
1756 DefFrameProcW( WIN_Handle32(hwnd
), WIN_Handle32(hwndMDIClient
),
1757 message
, wParam
, (LPARAM
)&next_menu
);
1758 return MAKELONG( HMENU_16(next_menu
.hmenuNext
), HWND_16(next_menu
.hwndNext
) );
1761 return DefWindowProc16(hwnd
, message
, wParam
, lParam
);
1766 /***********************************************************************
1767 * DefMDIChildProc (USER.447)
1769 LRESULT WINAPI
DefMDIChildProc16( HWND16 hwnd
, UINT16 message
,
1770 WPARAM16 wParam
, LPARAM lParam
)
1775 return DefMDIChildProcA( WIN_Handle32(hwnd
), message
, wParam
, (LPARAM
)MapSL(lParam
) );
1780 case WM_CHILDACTIVATE
:
1785 return DefMDIChildProcW( WIN_Handle32(hwnd
), message
, wParam
, lParam
);
1787 case WM_GETMINMAXINFO
:
1789 MINMAXINFO16
*mmi16
= MapSL(lParam
);
1792 mmi
.ptReserved
.x
= mmi16
->ptReserved
.x
;
1793 mmi
.ptReserved
.y
= mmi16
->ptReserved
.y
;
1794 mmi
.ptMaxSize
.x
= mmi16
->ptMaxSize
.x
;
1795 mmi
.ptMaxSize
.y
= mmi16
->ptMaxSize
.y
;
1796 mmi
.ptMaxPosition
.x
= mmi16
->ptMaxPosition
.x
;
1797 mmi
.ptMaxPosition
.y
= mmi16
->ptMaxPosition
.y
;
1798 mmi
.ptMinTrackSize
.x
= mmi16
->ptMinTrackSize
.x
;
1799 mmi
.ptMinTrackSize
.y
= mmi16
->ptMinTrackSize
.y
;
1800 mmi
.ptMaxTrackSize
.x
= mmi16
->ptMaxTrackSize
.x
;
1801 mmi
.ptMaxTrackSize
.y
= mmi16
->ptMaxTrackSize
.y
;
1803 DefMDIChildProcW( WIN_Handle32(hwnd
), message
, wParam
, (LPARAM
)&mmi
);
1805 mmi16
->ptReserved
.x
= mmi
.ptReserved
.x
;
1806 mmi16
->ptReserved
.y
= mmi
.ptReserved
.y
;
1807 mmi16
->ptMaxSize
.x
= mmi
.ptMaxSize
.x
;
1808 mmi16
->ptMaxSize
.y
= mmi
.ptMaxSize
.y
;
1809 mmi16
->ptMaxPosition
.x
= mmi
.ptMaxPosition
.x
;
1810 mmi16
->ptMaxPosition
.y
= mmi
.ptMaxPosition
.y
;
1811 mmi16
->ptMinTrackSize
.x
= mmi
.ptMinTrackSize
.x
;
1812 mmi16
->ptMinTrackSize
.y
= mmi
.ptMinTrackSize
.y
;
1813 mmi16
->ptMaxTrackSize
.x
= mmi
.ptMaxTrackSize
.x
;
1814 mmi16
->ptMaxTrackSize
.y
= mmi
.ptMaxTrackSize
.y
;
1819 MDINEXTMENU next_menu
;
1820 DefMDIChildProcW( WIN_Handle32(hwnd
), message
, wParam
, (LPARAM
)&next_menu
);
1821 return MAKELONG( HMENU_16(next_menu
.hmenuNext
), HWND_16(next_menu
.hwndNext
) );
1824 return DefWindowProc16(hwnd
, message
, wParam
, lParam
);
1829 /**************************************************************************
1830 * DrawAnimatedRects (USER.448)
1832 BOOL16 WINAPI
DrawAnimatedRects16( HWND16 hwnd
, INT16 idAni
,
1833 const RECT16
* lprcFrom
, const RECT16
* lprcTo
)
1835 RECT rcFrom32
, rcTo32
;
1836 rcFrom32
.left
= lprcFrom
->left
;
1837 rcFrom32
.top
= lprcFrom
->top
;
1838 rcFrom32
.right
= lprcFrom
->right
;
1839 rcFrom32
.bottom
= lprcFrom
->bottom
;
1840 rcTo32
.left
= lprcTo
->left
;
1841 rcTo32
.top
= lprcTo
->top
;
1842 rcTo32
.right
= lprcTo
->right
;
1843 rcTo32
.bottom
= lprcTo
->bottom
;
1844 return DrawAnimatedRects( WIN_Handle32(hwnd
), idAni
, &rcFrom32
, &rcTo32
);
1848 /***********************************************************************
1849 * CreateWindowEx (USER.452)
1851 HWND16 WINAPI
CreateWindowEx16( DWORD exStyle
, LPCSTR className
,
1852 LPCSTR windowName
, DWORD style
, INT16 x
,
1853 INT16 y
, INT16 width
, INT16 height
,
1854 HWND16 parent
, HMENU16 menu
,
1855 HINSTANCE16 instance
, LPVOID data
)
1861 /* Fix the coordinates */
1863 cs
.x
= (x
== CW_USEDEFAULT16
) ? CW_USEDEFAULT
: (INT
)x
;
1864 cs
.y
= (y
== CW_USEDEFAULT16
) ? CW_USEDEFAULT
: (INT
)y
;
1865 cs
.cx
= (width
== CW_USEDEFAULT16
) ? CW_USEDEFAULT
: (INT
)width
;
1866 cs
.cy
= (height
== CW_USEDEFAULT16
) ? CW_USEDEFAULT
: (INT
)height
;
1868 /* Create the window */
1870 cs
.lpCreateParams
= data
;
1871 cs
.hInstance
= HINSTANCE_32(instance
);
1872 cs
.hMenu
= HMENU_32(menu
);
1873 cs
.hwndParent
= WIN_Handle32( parent
);
1875 cs
.lpszName
= windowName
;
1876 cs
.lpszClass
= className
;
1877 cs
.dwExStyle
= exStyle
;
1880 if (!menu
&& (style
& (WS_CHILD
| WS_POPUP
)) != WS_CHILD
)
1883 HINSTANCE16 module
= GetExePtr( instance
);
1885 if (GetClassInfoA( HINSTANCE_32(module
), className
, &class ))
1886 cs
.hMenu
= HMENU_32( LoadMenu16( module
, class.lpszMenuName
));
1889 if (!IS_INTRESOURCE(className
))
1893 if (!MultiByteToWideChar( CP_ACP
, 0, className
, -1, bufferW
, sizeof(bufferW
)/sizeof(WCHAR
) ))
1895 hwnd
= create_window16( (CREATESTRUCTW
*)&cs
, bufferW
, HINSTANCE_32(instance
), FALSE
);
1899 if (!GlobalGetAtomNameA( LOWORD(className
), buffer
, sizeof(buffer
) )) return 0;
1900 cs
.lpszClass
= buffer
;
1901 hwnd
= create_window16( (CREATESTRUCTW
*)&cs
, (LPCWSTR
)className
, HINSTANCE_32(instance
), FALSE
);
1903 return HWND_16( hwnd
);
1907 /***********************************************************************
1908 * GetInternalWindowPos (USER.460)
1910 UINT16 WINAPI
GetInternalWindowPos16( HWND16 hwnd
, LPRECT16 rectWnd
, LPPOINT16 ptIcon
)
1912 WINDOWPLACEMENT16 wndpl
;
1914 if (!GetWindowPlacement16( hwnd
, &wndpl
)) return 0;
1915 if (rectWnd
) *rectWnd
= wndpl
.rcNormalPosition
;
1916 if (ptIcon
) *ptIcon
= wndpl
.ptMinPosition
;
1917 return wndpl
.showCmd
;
1921 /**************************************************************************
1922 * SetInternalWindowPos (USER.461)
1924 void WINAPI
SetInternalWindowPos16( HWND16 hwnd
, UINT16 showCmd
, LPRECT16 rect
, LPPOINT16 pt
)
1931 rc32
.left
= rect
->left
;
1932 rc32
.top
= rect
->top
;
1933 rc32
.right
= rect
->right
;
1934 rc32
.bottom
= rect
->bottom
;
1941 SetInternalWindowPos( WIN_Handle32(hwnd
), showCmd
,
1942 rect
? &rc32
: NULL
, pt
? &pt32
: NULL
);
1946 /**************************************************************************
1947 * CalcChildScroll (USER.462)
1949 void WINAPI
CalcChildScroll16( HWND16 hwnd
, WORD scroll
)
1951 CalcChildScroll( WIN_Handle32(hwnd
), scroll
);
1955 /**************************************************************************
1956 * ScrollChildren (USER.463)
1958 void WINAPI
ScrollChildren16(HWND16 hwnd
, UINT16 uMsg
, WPARAM16 wParam
, LPARAM lParam
)
1960 ScrollChildren( WIN_Handle32(hwnd
), uMsg
, wParam
, lParam
);
1964 /**************************************************************************
1965 * DragDetect (USER.465)
1967 BOOL16 WINAPI
DragDetect16( HWND16 hwnd
, POINT16 pt
)
1973 return DragDetect( WIN_Handle32(hwnd
), pt32
);
1977 /**************************************************************************
1978 * SetScrollInfo (USER.475)
1980 INT16 WINAPI
SetScrollInfo16( HWND16 hwnd
, INT16 nBar
, const SCROLLINFO
*info
, BOOL16 redraw
)
1982 return SetScrollInfo( WIN_Handle32(hwnd
), nBar
, info
, redraw
);
1986 /**************************************************************************
1987 * GetScrollInfo (USER.476)
1989 BOOL16 WINAPI
GetScrollInfo16( HWND16 hwnd
, INT16 nBar
, LPSCROLLINFO info
)
1991 return GetScrollInfo( WIN_Handle32(hwnd
), nBar
, info
);
1995 /**************************************************************************
1996 * EnableScrollBar (USER.482)
1998 BOOL16 WINAPI
EnableScrollBar16( HWND16 hwnd
, INT16 nBar
, UINT16 flags
)
2000 return EnableScrollBar( WIN_Handle32(hwnd
), nBar
, flags
);
2004 /**************************************************************************
2005 * GetShellWindow (USER.600)
2007 HWND16 WINAPI
GetShellWindow16(void)
2009 return HWND_16( GetShellWindow() );
2013 /**************************************************************************
2014 * GetForegroundWindow (USER.608)
2016 HWND16 WINAPI
GetForegroundWindow16(void)
2018 return HWND_16( GetForegroundWindow() );
2022 /**************************************************************************
2023 * SetForegroundWindow (USER.609)
2025 BOOL16 WINAPI
SetForegroundWindow16( HWND16 hwnd
)
2027 return SetForegroundWindow( WIN_Handle32(hwnd
) );
2031 /**************************************************************************
2032 * DrawCaptionTemp (USER.657)
2034 BOOL16 WINAPI
DrawCaptionTemp16( HWND16 hwnd
, HDC16 hdc
, const RECT16
*rect
,
2035 HFONT16 hFont
, HICON16 hIcon
, LPCSTR str
, UINT16 uFlags
)
2041 rect32
.left
= rect
->left
;
2042 rect32
.top
= rect
->top
;
2043 rect32
.right
= rect
->right
;
2044 rect32
.bottom
= rect
->bottom
;
2046 return DrawCaptionTempA( WIN_Handle32(hwnd
), HDC_32(hdc
),
2047 rect
? &rect32
: NULL
, HFONT_32(hFont
),
2048 HICON_32(hIcon
), str
, uFlags
& 0x1f );
2052 /**************************************************************************
2053 * DrawCaption (USER.660)
2055 BOOL16 WINAPI
DrawCaption16( HWND16 hwnd
, HDC16 hdc
, const RECT16
*rect
, UINT16 flags
)
2061 rect32
.left
= rect
->left
;
2062 rect32
.top
= rect
->top
;
2063 rect32
.right
= rect
->right
;
2064 rect32
.bottom
= rect
->bottom
;
2066 return DrawCaption(WIN_Handle32(hwnd
), HDC_32(hdc
), rect
? &rect32
: NULL
, flags
);
2070 /**************************************************************************
2071 * GetMenuItemRect (USER.665)
2073 BOOL16 WINAPI
GetMenuItemRect16( HWND16 hwnd
, HMENU16 hMenu
, UINT16 uItem
,
2078 if (!rect
) return FALSE
;
2079 res
= GetMenuItemRect( WIN_Handle32(hwnd
), HMENU_32(hMenu
), uItem
, &r32
);
2080 rect
->left
= r32
.left
;
2081 rect
->top
= r32
.top
;
2082 rect
->right
= r32
.right
;
2083 rect
->bottom
= r32
.bottom
;
2088 /**************************************************************************
2089 * SetWindowRgn (USER.668)
2091 INT16 WINAPI
SetWindowRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 redraw
)
2093 return SetWindowRgn( WIN_Handle32(hwnd
), HRGN_32(hrgn
), redraw
);
2097 /**************************************************************************
2098 * MessageBoxIndirect (USER.827)
2100 INT16 WINAPI
MessageBoxIndirect16( LPMSGBOXPARAMS16 msgbox
)
2102 MSGBOXPARAMSA msgbox32
;
2104 msgbox32
.cbSize
= msgbox
->cbSize
;
2105 msgbox32
.hwndOwner
= WIN_Handle32( msgbox
->hwndOwner
);
2106 msgbox32
.hInstance
= HINSTANCE_32(msgbox
->hInstance
);
2107 msgbox32
.lpszText
= MapSL(msgbox
->lpszText
);
2108 msgbox32
.lpszCaption
= MapSL(msgbox
->lpszCaption
);
2109 msgbox32
.dwStyle
= msgbox
->dwStyle
;
2110 msgbox32
.lpszIcon
= MapSL(msgbox
->lpszIcon
);
2111 msgbox32
.dwContextHelpId
= msgbox
->dwContextHelpId
;
2112 msgbox32
.lpfnMsgBoxCallback
= msgbox
->lpfnMsgBoxCallback
;
2113 msgbox32
.dwLanguageId
= msgbox
->dwLanguageId
;
2114 return MessageBoxIndirectA( &msgbox32
);