2 * Misc 16-bit USER functions
4 * Copyright 2002 Patrik Stridvall
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/winuser16.h"
28 /* handle to handle 16 conversions */
29 #define HANDLE_16(h32) (LOWORD(h32))
31 /* handle16 to handle conversions */
32 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
33 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
35 #define IS_MENU_STRING_ITEM(flags) \
36 (((flags) & (MF_STRING | MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR)) == MF_STRING)
38 WORD WINAPI
DestroyIcon32(HGLOBAL16
, UINT16
);
41 /* ### start build ### */
42 extern WORD CALLBACK
USER_CallTo16_word_wlw(GRAYSTRINGPROC16
,WORD
,LONG
,WORD
);
43 /* ### stop build ### */
45 struct gray_string_info
47 GRAYSTRINGPROC16 proc
;
52 /* callback for 16-bit gray string proc with opaque pointer */
53 static BOOL CALLBACK
gray_string_callback( HDC hdc
, LPARAM param
, INT len
)
55 const struct gray_string_info
*info
= (struct gray_string_info
*)param
;
56 return USER_CallTo16_word_wlw( info
->proc
, HDC_16(hdc
), info
->param
, len
);
59 /* callback for 16-bit gray string proc with string pointer */
60 static BOOL CALLBACK
gray_string_callback_ptr( HDC hdc
, LPARAM param
, INT len
)
62 const struct gray_string_info
*info
;
63 char *str
= (char *)param
;
65 info
= (struct gray_string_info
*)(str
- offsetof( struct gray_string_info
, str
));
66 return USER_CallTo16_word_wlw( info
->proc
, HDC_16(hdc
), info
->param
, len
);
69 /***********************************************************************
72 HCURSOR16 WINAPI
SetCursor16(HCURSOR16 hCursor
)
74 return HCURSOR_16(SetCursor(HCURSOR_32(hCursor
)));
77 /***********************************************************************
78 * ShowCursor (USER.71)
80 INT16 WINAPI
ShowCursor16(BOOL16 bShow
)
82 return ShowCursor(bShow
);
85 /***********************************************************************
88 BOOL16 WINAPI
DrawIcon16(HDC16 hdc
, INT16 x
, INT16 y
, HICON16 hIcon
)
90 return DrawIcon(HDC_32(hdc
), x
, y
, HICON_32(hIcon
));
94 /***********************************************************************
97 INT16 WINAPI
DrawText16( HDC16 hdc
, LPCSTR str
, INT16 count
, LPRECT16 rect
, UINT16 flags
)
104 CONV_RECT16TO32( rect
, &rect32
);
105 ret
= DrawTextA( HDC_32(hdc
), str
, count
, &rect32
, flags
);
106 CONV_RECT32TO16( &rect32
, rect
);
108 else ret
= DrawTextA( HDC_32(hdc
), str
, count
, NULL
, flags
);
113 /***********************************************************************
116 * See "Undocumented Windows". Used by W2.0 paint.exe.
118 DWORD WINAPI
IconSize16(void)
120 return MAKELONG(GetSystemMetrics(SM_CYICON
), GetSystemMetrics(SM_CXICON
));
124 /**********************************************************************
125 * CreateMenu (USER.151)
127 HMENU16 WINAPI
CreateMenu16(void)
129 return HMENU_16( CreateMenu() );
133 /**********************************************************************
134 * DestroyMenu (USER.152)
136 BOOL16 WINAPI
DestroyMenu16( HMENU16 hMenu
)
138 return DestroyMenu( HMENU_32(hMenu
) );
142 /*******************************************************************
143 * ChangeMenu (USER.153)
145 BOOL16 WINAPI
ChangeMenu16( HMENU16 hMenu
, UINT16 pos
, SEGPTR data
,
146 UINT16 id
, UINT16 flags
)
148 if (flags
& MF_APPEND
) return AppendMenu16( hMenu
, flags
& ~MF_APPEND
, id
, data
);
150 /* FIXME: Word passes the item id in 'pos' and 0 or 0xffff as id */
151 /* for MF_DELETE. We should check the parameters for all others */
152 /* MF_* actions also (anybody got a doc on ChangeMenu?). */
154 if (flags
& MF_DELETE
) return DeleteMenu16(hMenu
, pos
, flags
& ~MF_DELETE
);
155 if (flags
& MF_CHANGE
) return ModifyMenu16(hMenu
, pos
, flags
& ~MF_CHANGE
, id
, data
);
156 if (flags
& MF_REMOVE
) return RemoveMenu16(hMenu
, flags
& MF_BYPOSITION
? pos
: id
,
157 flags
& ~MF_REMOVE
);
158 /* Default: MF_INSERT */
159 return InsertMenu16( hMenu
, pos
, flags
, id
, data
);
163 /*******************************************************************
164 * CheckMenuItem (USER.154)
166 BOOL16 WINAPI
CheckMenuItem16( HMENU16 hMenu
, UINT16 id
, UINT16 flags
)
168 return CheckMenuItem( HMENU_32(hMenu
), id
, flags
);
172 /**********************************************************************
173 * EnableMenuItem (USER.155)
175 UINT16 WINAPI
EnableMenuItem16( HMENU16 hMenu
, UINT16 wItemID
, UINT16 wFlags
)
177 return EnableMenuItem( HMENU_32(hMenu
), wItemID
, wFlags
);
181 /**********************************************************************
182 * GetSubMenu (USER.159)
184 HMENU16 WINAPI
GetSubMenu16( HMENU16 hMenu
, INT16 nPos
)
186 return HMENU_16( GetSubMenu( HMENU_32(hMenu
), nPos
) );
190 /*******************************************************************
191 * GetMenuString (USER.161)
193 INT16 WINAPI
GetMenuString16( HMENU16 hMenu
, UINT16 wItemID
,
194 LPSTR str
, INT16 nMaxSiz
, UINT16 wFlags
)
196 return GetMenuStringA( HMENU_32(hMenu
), wItemID
, str
, nMaxSiz
, wFlags
);
200 /**********************************************************************
203 BOOL16 WINAPI
WinHelp16( HWND16 hWnd
, LPCSTR lpHelpFile
, UINT16 wCommand
,
209 /* We might call WinExec() */
210 ReleaseThunkLock(&mutex_count
);
212 ret
= WinHelpA(WIN_Handle32(hWnd
), lpHelpFile
, wCommand
, (DWORD
)MapSL(dwData
));
214 RestoreThunkLock(mutex_count
);
219 /***********************************************************************
220 * LoadCursor (USER.173)
222 HCURSOR16 WINAPI
LoadCursor16(HINSTANCE16 hInstance
, LPCSTR name
)
224 return HCURSOR_16(LoadCursorA(HINSTANCE_32(hInstance
), name
));
228 /***********************************************************************
229 * LoadIcon (USER.174)
231 HICON16 WINAPI
LoadIcon16(HINSTANCE16 hInstance
, LPCSTR name
)
233 return HICON_16(LoadIconA(HINSTANCE_32(hInstance
), name
));
236 /**********************************************************************
237 * LoadBitmap (USER.175)
239 HBITMAP16 WINAPI
LoadBitmap16(HINSTANCE16 hInstance
, LPCSTR name
)
241 return HBITMAP_16(LoadBitmapA(HINSTANCE_32(hInstance
), name
));
245 /***********************************************************************
246 * GrayString (USER.185)
248 BOOL16 WINAPI
GrayString16( HDC16 hdc
, HBRUSH16 hbr
, GRAYSTRINGPROC16 gsprc
,
249 LPARAM lParam
, INT16 cch
, INT16 x
, INT16 y
,
254 if (!gsprc
) return GrayStringA( HDC_32(hdc
), HBRUSH_32(hbr
), NULL
,
255 (LPARAM
)MapSL(lParam
), cch
, x
, y
, cx
, cy
);
257 if (cch
== -1 || (cch
&& cx
&& cy
))
259 /* lParam can be treated as an opaque pointer */
260 struct gray_string_info info
;
264 ret
= GrayStringA( HDC_32(hdc
), HBRUSH_32(hbr
), gray_string_callback
,
265 (LPARAM
)&info
, cch
, x
, y
, cx
, cy
);
267 else /* here we need some string conversions */
269 char *str16
= MapSL(lParam
);
270 struct gray_string_info
*info
;
272 if (!cch
) cch
= strlen(str16
);
273 if (!(info
= HeapAlloc( GetProcessHeap(), 0, sizeof(*info
) + cch
))) return FALSE
;
275 info
->param
= lParam
;
276 memcpy( info
->str
, str16
, cch
);
277 ret
= GrayStringA( HDC_32(hdc
), HBRUSH_32(hbr
), gray_string_callback_ptr
,
278 (LPARAM
)info
->str
, cch
, x
, y
, cx
, cy
);
279 HeapFree( GetProcessHeap(), 0, info
);
285 /***********************************************************************
286 * TabbedTextOut (USER.196)
288 LONG WINAPI
TabbedTextOut16( HDC16 hdc
, INT16 x
, INT16 y
, LPCSTR lpstr
,
289 INT16 count
, INT16 nb_tabs
, const INT16
*tabs16
, INT16 tab_org
)
292 INT i
, *tabs
= HeapAlloc( GetProcessHeap(), 0, nb_tabs
* sizeof(tabs
) );
294 for (i
= 0; i
< nb_tabs
; i
++) tabs
[i
] = tabs16
[i
];
295 ret
= TabbedTextOutA( HDC_32(hdc
), x
, y
, lpstr
, count
, nb_tabs
, tabs
, tab_org
);
296 HeapFree( GetProcessHeap(), 0, tabs
);
301 /***********************************************************************
302 * GetTabbedTextExtent (USER.197)
304 DWORD WINAPI
GetTabbedTextExtent16( HDC16 hdc
, LPCSTR lpstr
, INT16 count
,
305 INT16 nb_tabs
, const INT16
*tabs16
)
308 INT i
, *tabs
= HeapAlloc( GetProcessHeap(), 0, nb_tabs
* sizeof(tabs
) );
310 for (i
= 0; i
< nb_tabs
; i
++) tabs
[i
] = tabs16
[i
];
311 ret
= GetTabbedTextExtentA( HDC_32(hdc
), lpstr
, count
, nb_tabs
, tabs
);
312 HeapFree( GetProcessHeap(), 0, tabs
);
317 /*************************************************************************
318 * ScrollDC (USER.221)
320 BOOL16 WINAPI
ScrollDC16( HDC16 hdc
, INT16 dx
, INT16 dy
, const RECT16
*rect
,
321 const RECT16
*cliprc
, HRGN16 hrgnUpdate
,
324 RECT rect32
, clipRect32
, rcUpdate32
;
327 if (rect
) CONV_RECT16TO32( rect
, &rect32
);
328 if (cliprc
) CONV_RECT16TO32( cliprc
, &clipRect32
);
329 ret
= ScrollDC( HDC_32(hdc
), dx
, dy
, rect
? &rect32
: NULL
,
330 cliprc
? &clipRect32
: NULL
, HRGN_32(hrgnUpdate
),
332 if (rcUpdate
) CONV_RECT32TO16( &rcUpdate32
, rcUpdate
);
336 /***********************************************************************
337 * GetCursor (USER.247)
339 HCURSOR16 WINAPI
GetCursor16(void)
341 return HCURSOR_16(GetCursor());
345 /**********************************************************************
346 * GetMenuState (USER.250)
348 UINT16 WINAPI
GetMenuState16( HMENU16 hMenu
, UINT16 wItemID
, UINT16 wFlags
)
350 return GetMenuState( HMENU_32(hMenu
), wItemID
, wFlags
);
354 /**********************************************************************
355 * GetMenuItemCount (USER.263)
357 INT16 WINAPI
GetMenuItemCount16( HMENU16 hMenu
)
359 return GetMenuItemCount( HMENU_32(hMenu
) );
363 /**********************************************************************
364 * GetMenuItemID (USER.264)
366 UINT16 WINAPI
GetMenuItemID16( HMENU16 hMenu
, INT16 nPos
)
368 return GetMenuItemID( HMENU_32(hMenu
), nPos
);
372 /***********************************************************************
373 * GlobalAddAtom (USER.268)
375 ATOM WINAPI
GlobalAddAtom16(LPCSTR lpString
)
377 return GlobalAddAtomA(lpString
);
380 /***********************************************************************
381 * GlobalDeleteAtom (USER.269)
383 ATOM WINAPI
GlobalDeleteAtom16(ATOM nAtom
)
385 return GlobalDeleteAtom(nAtom
);
388 /***********************************************************************
389 * GlobalFindAtom (USER.270)
391 ATOM WINAPI
GlobalFindAtom16(LPCSTR lpString
)
393 return GlobalFindAtomA(lpString
);
396 /***********************************************************************
397 * GlobalGetAtomName (USER.271)
399 UINT16 WINAPI
GlobalGetAtomName16(ATOM nAtom
, LPSTR lpBuffer
, INT16 nSize
)
401 return GlobalGetAtomNameA(nAtom
, lpBuffer
, nSize
);
405 /***********************************************************************
406 * GetSysColorBrush (USER.281)
408 HBRUSH16 WINAPI
GetSysColorBrush16( INT16 index
)
410 return HBRUSH_16( GetSysColorBrush(index
) );
414 /***********************************************************************
415 * SelectPalette (USER.282)
417 HPALETTE16 WINAPI
SelectPalette16( HDC16 hdc
, HPALETTE16 hpal
, BOOL16 bForceBackground
)
419 return HPALETTE_16( SelectPalette( HDC_32(hdc
), HPALETTE_32(hpal
), bForceBackground
));
422 /***********************************************************************
423 * RealizePalette (USER.283)
425 UINT16 WINAPI
RealizePalette16( HDC16 hdc
)
427 return UserRealizePalette( HDC_32(hdc
) );
431 /**********************************************************************
434 BOOL16 WINAPI
IsMenu16( HMENU16 hmenu
)
436 return IsMenu( HMENU_32(hmenu
) );
440 /**********************************************************************
441 * SetMenuContextHelpId (USER.384)
443 BOOL16 WINAPI
SetMenuContextHelpId16( HMENU16 hMenu
, DWORD dwContextHelpID
)
445 return SetMenuContextHelpId( HMENU_32(hMenu
), dwContextHelpID
);
449 /**********************************************************************
450 * GetMenuContextHelpId (USER.385)
452 DWORD WINAPI
GetMenuContextHelpId16( HMENU16 hMenu
)
454 return GetMenuContextHelpId( HMENU_32(hMenu
) );
458 /***********************************************************************
459 * LoadImage (USER.389)
462 HANDLE16 WINAPI
LoadImage16(HINSTANCE16 hinst
, LPCSTR name
, UINT16 type
,
463 INT16 desiredx
, INT16 desiredy
, UINT16 loadflags
)
465 return HANDLE_16(LoadImageA(HINSTANCE_32(hinst
), name
, type
, desiredx
,
466 desiredy
, loadflags
));
469 /******************************************************************************
470 * CopyImage (USER.390) Creates new image and copies attributes to it
473 HICON16 WINAPI
CopyImage16(HANDLE16 hnd
, UINT16 type
, INT16 desiredx
,
474 INT16 desiredy
, UINT16 flags
)
476 return HICON_16(CopyImage(HANDLE_32(hnd
), (UINT
)type
, (INT
)desiredx
,
477 (INT
)desiredy
, (UINT
)flags
));
480 /**********************************************************************
481 * DrawIconEx (USER.394)
483 BOOL16 WINAPI
DrawIconEx16(HDC16 hdc
, INT16 xLeft
, INT16 yTop
, HICON16 hIcon
,
484 INT16 cxWidth
, INT16 cyWidth
, UINT16 istep
,
485 HBRUSH16 hbr
, UINT16 flags
)
487 return DrawIconEx(HDC_32(hdc
), xLeft
, yTop
, HICON_32(hIcon
), cxWidth
, cyWidth
,
488 istep
, HBRUSH_32(hbr
), flags
);
491 /**********************************************************************
492 * GetIconInfo (USER.395)
494 BOOL16 WINAPI
GetIconInfo16(HICON16 hIcon
, LPICONINFO16 iconinfo
)
497 BOOL16 ret
= GetIconInfo(HICON_32(hIcon
), &ii32
);
499 iconinfo
->fIcon
= ii32
.fIcon
;
500 iconinfo
->xHotspot
= ii32
.xHotspot
;
501 iconinfo
->yHotspot
= ii32
.yHotspot
;
502 iconinfo
->hbmMask
= HBITMAP_16(ii32
.hbmMask
);
503 iconinfo
->hbmColor
= HBITMAP_16(ii32
.hbmColor
);
507 /***********************************************************************
508 * CreateCursor (USER.406)
510 HCURSOR16 WINAPI
CreateCursor16(HINSTANCE16 hInstance
,
511 INT16 xHotSpot
, INT16 yHotSpot
,
512 INT16 nWidth
, INT16 nHeight
,
513 LPCVOID lpANDbits
, LPCVOID lpXORbits
)
517 info
.ptHotSpot
.x
= xHotSpot
;
518 info
.ptHotSpot
.y
= yHotSpot
;
519 info
.nWidth
= nWidth
;
520 info
.nHeight
= nHeight
;
521 info
.nWidthBytes
= 0;
523 info
.bBitsPerPixel
= 1;
525 return CreateCursorIconIndirect16(hInstance
, &info
, lpANDbits
, lpXORbits
);
529 /*******************************************************************
530 * InsertMenu (USER.410)
532 BOOL16 WINAPI
InsertMenu16( HMENU16 hMenu
, UINT16 pos
, UINT16 flags
,
533 UINT16 id
, SEGPTR data
)
535 UINT pos32
= (UINT
)pos
;
536 if ((pos
== (UINT16
)-1) && (flags
& MF_BYPOSITION
)) pos32
= (UINT
)-1;
537 if (IS_MENU_STRING_ITEM(flags
) && data
)
538 return InsertMenuA( HMENU_32(hMenu
), pos32
, flags
, id
, MapSL(data
) );
539 return InsertMenuA( HMENU_32(hMenu
), pos32
, flags
, id
, (LPSTR
)data
);
543 /*******************************************************************
544 * AppendMenu (USER.411)
546 BOOL16 WINAPI
AppendMenu16(HMENU16 hMenu
, UINT16 flags
, UINT16 id
, SEGPTR data
)
548 return InsertMenu16( hMenu
, -1, flags
| MF_BYPOSITION
, id
, data
);
552 /**********************************************************************
553 * RemoveMenu (USER.412)
555 BOOL16 WINAPI
RemoveMenu16( HMENU16 hMenu
, UINT16 nPos
, UINT16 wFlags
)
557 return RemoveMenu( HMENU_32(hMenu
), nPos
, wFlags
);
561 /**********************************************************************
562 * DeleteMenu (USER.413)
564 BOOL16 WINAPI
DeleteMenu16( HMENU16 hMenu
, UINT16 nPos
, UINT16 wFlags
)
566 return DeleteMenu( HMENU_32(hMenu
), nPos
, wFlags
);
570 /*******************************************************************
571 * ModifyMenu (USER.414)
573 BOOL16 WINAPI
ModifyMenu16( HMENU16 hMenu
, UINT16 pos
, UINT16 flags
,
574 UINT16 id
, SEGPTR data
)
576 if (IS_MENU_STRING_ITEM(flags
))
577 return ModifyMenuA( HMENU_32(hMenu
), pos
, flags
, id
, MapSL(data
) );
578 return ModifyMenuA( HMENU_32(hMenu
), pos
, flags
, id
, (LPSTR
)data
);
582 /**********************************************************************
583 * CreatePopupMenu (USER.415)
585 HMENU16 WINAPI
CreatePopupMenu16(void)
587 return HMENU_16( CreatePopupMenu() );
591 /**********************************************************************
592 * SetMenuItemBitmaps (USER.418)
594 BOOL16 WINAPI
SetMenuItemBitmaps16( HMENU16 hMenu
, UINT16 nPos
, UINT16 wFlags
,
595 HBITMAP16 hNewUnCheck
, HBITMAP16 hNewCheck
)
597 return SetMenuItemBitmaps( HMENU_32(hMenu
), nPos
, wFlags
,
598 HBITMAP_32(hNewUnCheck
), HBITMAP_32(hNewCheck
) );
602 /*******************************************************************
603 * InsertMenuItem (USER.441)
607 BOOL16 WINAPI
InsertMenuItem16( HMENU16 hmenu
, UINT16 pos
, BOOL16 byposition
,
608 const MENUITEMINFO16
*mii
)
612 miia
.cbSize
= sizeof(miia
);
613 miia
.fMask
= mii
->fMask
;
614 miia
.dwTypeData
= (LPSTR
)mii
->dwTypeData
;
615 miia
.fType
= mii
->fType
;
616 miia
.fState
= mii
->fState
;
618 miia
.hSubMenu
= HMENU_32(mii
->hSubMenu
);
619 miia
.hbmpChecked
= HBITMAP_32(mii
->hbmpChecked
);
620 miia
.hbmpUnchecked
= HBITMAP_32(mii
->hbmpUnchecked
);
621 miia
.dwItemData
= mii
->dwItemData
;
623 if (IS_MENU_STRING_ITEM(miia
.fType
))
624 miia
.dwTypeData
= MapSL(mii
->dwTypeData
);
625 return InsertMenuItemA( HMENU_32(hmenu
), pos
, byposition
, &miia
);
629 /**********************************************************************
630 * CreateIconFromResourceEx (USER.450)
632 * FIXME: not sure about exact parameter types
634 HICON16 WINAPI
CreateIconFromResourceEx16(LPBYTE bits
, UINT16 cbSize
,
635 BOOL16 bIcon
, DWORD dwVersion
,
636 INT16 width
, INT16 height
,
639 return HICON_16(CreateIconFromResourceEx(bits
, cbSize
, bIcon
, dwVersion
,
640 width
, height
, cFlag
));
643 /***********************************************************************
644 * DestroyIcon (USER.457)
646 BOOL16 WINAPI
DestroyIcon16(HICON16 hIcon
)
648 return DestroyIcon32(hIcon
, 0);
651 /***********************************************************************
652 * DestroyCursor (USER.458)
654 BOOL16 WINAPI
DestroyCursor16(HCURSOR16 hCursor
)
656 return DestroyIcon32(hCursor
, 0);
659 /*******************************************************************
662 * Recursively find a child that contains spDragInfo->pt point
663 * and send WM_QUERYDROPOBJECT. Helper for DragObject16.
665 static BOOL
DRAG_QueryUpdate16( HWND hQueryWnd
, SEGPTR spDragInfo
)
670 LPDRAGINFO16 ptrDragInfo
= MapSL(spDragInfo
);
674 if (!IsWindowEnabled(hQueryWnd
)) return FALSE
;
676 old_pt
.x
= ptrDragInfo
->pt
.x
;
677 old_pt
.y
= ptrDragInfo
->pt
.y
;
679 ScreenToClient( hQueryWnd
, &pt
);
680 child
= ChildWindowFromPointEx( hQueryWnd
, pt
, CWP_SKIPINVISIBLE
);
681 if (!child
) return FALSE
;
683 if (child
!= hQueryWnd
)
686 if (DRAG_QueryUpdate16( child
, spDragInfo
)) return TRUE
;
690 GetClientRect( hQueryWnd
, &tempRect
);
691 wParam
= !PtInRect( &tempRect
, pt
);
694 ptrDragInfo
->pt
.x
= pt
.x
;
695 ptrDragInfo
->pt
.y
= pt
.y
;
696 ptrDragInfo
->hScope
= HWND_16(hQueryWnd
);
698 bResult
= SendMessage16( HWND_16(hQueryWnd
), WM_QUERYDROPOBJECT
, wParam
, spDragInfo
);
702 ptrDragInfo
->pt
.x
= old_pt
.x
;
703 ptrDragInfo
->pt
.y
= old_pt
.y
;
709 /******************************************************************************
710 * DragObject (USER.464)
712 DWORD WINAPI
DragObject16( HWND16 hwndScope
, HWND16 hWnd
, UINT16 wObj
,
713 HANDLE16 hOfStruct
, WORD szList
, HCURSOR16 hCursor
)
716 LPDRAGINFO16 lpDragInfo
;
718 HCURSOR hOldCursor
=0, hBummer
=0;
719 HGLOBAL16 hDragInfo
= GlobalAlloc16( GMEM_SHARE
| GMEM_ZEROINIT
, 2*sizeof(DRAGINFO16
));
720 HCURSOR hCurrentCursor
= 0;
721 HWND16 hCurrentWnd
= 0;
723 lpDragInfo
= (LPDRAGINFO16
) GlobalLock16(hDragInfo
);
724 spDragInfo
= K32WOWGlobalLock16(hDragInfo
);
726 if( !lpDragInfo
|| !spDragInfo
) return 0L;
728 if (!(hBummer
= LoadCursorA(0, MAKEINTRESOURCEA(OCR_NO
))))
730 GlobalFree16(hDragInfo
);
734 if(hCursor
) hOldCursor
= SetCursor(HCURSOR_32(hCursor
));
736 lpDragInfo
->hWnd
= hWnd
;
737 lpDragInfo
->hScope
= 0;
738 lpDragInfo
->wFlags
= wObj
;
739 lpDragInfo
->hList
= szList
; /* near pointer! */
740 lpDragInfo
->hOfStruct
= hOfStruct
;
743 SetCapture( HWND_32(hWnd
) );
748 GetMessageW( &msg
, 0, WM_MOUSEFIRST
, WM_MOUSELAST
);
750 *(lpDragInfo
+1) = *lpDragInfo
;
752 lpDragInfo
->pt
.x
= msg
.pt
.x
;
753 lpDragInfo
->pt
.y
= msg
.pt
.y
;
755 /* update DRAGINFO struct */
756 if( DRAG_QueryUpdate16(WIN_Handle32(hwndScope
), spDragInfo
) > 0 )
757 hCurrentCursor
= HCURSOR_32(hCursor
);
760 hCurrentCursor
= hBummer
;
761 lpDragInfo
->hScope
= 0;
764 SetCursor(hCurrentCursor
);
766 /* send WM_DRAGLOOP */
767 SendMessage16( hWnd
, WM_DRAGLOOP
, (WPARAM16
)(hCurrentCursor
!= hBummer
),
768 (LPARAM
) spDragInfo
);
769 /* send WM_DRAGSELECT or WM_DRAGMOVE */
770 if( hCurrentWnd
!= lpDragInfo
->hScope
)
773 SendMessage16( hCurrentWnd
, WM_DRAGSELECT
, 0,
774 (LPARAM
)MAKELONG(LOWORD(spDragInfo
)+sizeof(DRAGINFO16
),
775 HIWORD(spDragInfo
)) );
776 hCurrentWnd
= lpDragInfo
->hScope
;
778 SendMessage16( hCurrentWnd
, WM_DRAGSELECT
, 1, (LPARAM
)spDragInfo
);
782 SendMessage16( hCurrentWnd
, WM_DRAGMOVE
, 0, (LPARAM
)spDragInfo
);
784 } while( msg
.message
!= WM_LBUTTONUP
&& msg
.message
!= WM_NCLBUTTONUP
);
789 if( hCursor
) SetCursor(hOldCursor
);
791 if( hCurrentCursor
!= hBummer
)
792 msg
.lParam
= SendMessage16( lpDragInfo
->hScope
, WM_DROPOBJECT
,
793 (WPARAM16
)hWnd
, (LPARAM
)spDragInfo
);
796 GlobalFree16(hDragInfo
);
798 return (DWORD
)(msg
.lParam
);
802 /**********************************************************************
803 * DrawFrameControl (USER.656)
805 BOOL16 WINAPI
DrawFrameControl16( HDC16 hdc
, LPRECT16 rc
, UINT16 uType
, UINT16 uState
)
810 CONV_RECT16TO32( rc
, &rect32
);
811 ret
= DrawFrameControl( HDC_32(hdc
), &rect32
, uType
, uState
);
812 CONV_RECT32TO16( &rect32
, rc
);
816 /**********************************************************************
817 * DrawEdge (USER.659)
819 BOOL16 WINAPI
DrawEdge16( HDC16 hdc
, LPRECT16 rc
, UINT16 edge
, UINT16 flags
)
824 CONV_RECT16TO32( rc
, &rect32
);
825 ret
= DrawEdge( HDC_32(hdc
), &rect32
, edge
, flags
);
826 CONV_RECT32TO16( &rect32
, rc
);
830 /**********************************************************************
831 * CheckMenuRadioItem (USER.666)
833 BOOL16 WINAPI
CheckMenuRadioItem16(HMENU16 hMenu
, UINT16 first
, UINT16 last
,
834 UINT16 check
, BOOL16 bypos
)
836 return CheckMenuRadioItem( HMENU_32(hMenu
), first
, last
, check
, bypos
);