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
21 #include "wine/winuser16.h"
26 /* handle to handle 16 conversions */
27 #define HANDLE_16(h32) (LOWORD(h32))
29 /* handle16 to handle conversions */
30 #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16))
31 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
33 WORD WINAPI
DestroyIcon32(HGLOBAL16
, UINT16
);
36 /***********************************************************************
39 HCURSOR16 WINAPI
SetCursor16(HCURSOR16 hCursor
)
41 return HCURSOR_16(SetCursor(HCURSOR_32(hCursor
)));
44 /***********************************************************************
45 * ShowCursor (USER.71)
47 INT16 WINAPI
ShowCursor16(BOOL16 bShow
)
49 return ShowCursor(bShow
);
52 /***********************************************************************
55 BOOL16 WINAPI
DrawIcon16(HDC16 hdc
, INT16 x
, INT16 y
, HICON16 hIcon
)
57 return DrawIcon(HDC_32(hdc
), x
, y
, HICON_32(hIcon
));
60 /***********************************************************************
63 * See "Undocumented Windows". Used by W2.0 paint.exe.
65 DWORD WINAPI
IconSize16(void)
67 return MAKELONG(GetSystemMetrics(SM_CYICON
), GetSystemMetrics(SM_CXICON
));
70 /***********************************************************************
71 * LoadCursor (USER.173)
73 HCURSOR16 WINAPI
LoadCursor16(HINSTANCE16 hInstance
, LPCSTR name
)
75 return HCURSOR_16(LoadCursorA(HINSTANCE_32(hInstance
), name
));
79 /***********************************************************************
82 HICON16 WINAPI
LoadIcon16(HINSTANCE16 hInstance
, LPCSTR name
)
84 return HICON_16(LoadIconA(HINSTANCE_32(hInstance
), name
));
87 /**********************************************************************
88 * LoadBitmap (USER.175)
90 HBITMAP16 WINAPI
LoadBitmap16(HINSTANCE16 hInstance
, LPCSTR name
)
92 return HBITMAP_16(LoadBitmapA(HINSTANCE_32(hInstance
), name
));
95 /***********************************************************************
96 * GetCursor (USER.247)
98 HCURSOR16 WINAPI
GetCursor16(void)
100 return HCURSOR_16(GetCursor());
103 /***********************************************************************
104 * GlobalAddAtom (USER.268)
106 ATOM WINAPI
GlobalAddAtom16(LPCSTR lpString
)
108 return GlobalAddAtomA(lpString
);
111 /***********************************************************************
112 * GlobalDeleteAtom (USER.269)
114 ATOM WINAPI
GlobalDeleteAtom16(ATOM nAtom
)
116 return GlobalDeleteAtom(nAtom
);
119 /***********************************************************************
120 * GlobalFindAtom (USER.270)
122 ATOM WINAPI
GlobalFindAtom16(LPCSTR lpString
)
124 return GlobalFindAtomA(lpString
);
127 /***********************************************************************
128 * GlobalGetAtomName (USER.271)
130 UINT16 WINAPI
GlobalGetAtomName16(ATOM nAtom
, LPSTR lpBuffer
, INT16 nSize
)
132 return GlobalGetAtomNameA(nAtom
, lpBuffer
, nSize
);
135 /***********************************************************************
136 * SelectPalette (USER.282)
138 HPALETTE16 WINAPI
SelectPalette16( HDC16 hdc
, HPALETTE16 hpal
, BOOL16 bForceBackground
)
140 return HPALETTE_16( SelectPalette( HDC_32(hdc
), HPALETTE_32(hpal
), bForceBackground
));
143 /***********************************************************************
144 * RealizePalette (USER.283)
146 UINT16 WINAPI
RealizePalette16( HDC16 hdc
)
148 return UserRealizePalette( HDC_32(hdc
) );
151 /***********************************************************************
152 * LoadImage (USER.389)
155 HANDLE16 WINAPI
LoadImage16(HINSTANCE16 hinst
, LPCSTR name
, UINT16 type
,
156 INT16 desiredx
, INT16 desiredy
, UINT16 loadflags
)
158 return HANDLE_16(LoadImageA(HINSTANCE_32(hinst
), name
, type
, desiredx
,
159 desiredy
, loadflags
));
162 /******************************************************************************
163 * CopyImage (USER.390) Creates new image and copies attributes to it
166 HICON16 WINAPI
CopyImage16(HANDLE16 hnd
, UINT16 type
, INT16 desiredx
,
167 INT16 desiredy
, UINT16 flags
)
169 return HICON_16(CopyImage(HANDLE_32(hnd
), (UINT
)type
, (INT
)desiredx
,
170 (INT
)desiredy
, (UINT
)flags
));
173 /**********************************************************************
174 * DrawIconEx (USER.394)
176 BOOL16 WINAPI
DrawIconEx16(HDC16 hdc
, INT16 xLeft
, INT16 yTop
, HICON16 hIcon
,
177 INT16 cxWidth
, INT16 cyWidth
, UINT16 istep
,
178 HBRUSH16 hbr
, UINT16 flags
)
180 return DrawIconEx(HDC_32(hdc
), xLeft
, yTop
, HICON_32(hIcon
), cxWidth
, cyWidth
,
181 istep
, HBRUSH_32(hbr
), flags
);
184 /**********************************************************************
185 * GetIconInfo (USER.395)
187 BOOL16 WINAPI
GetIconInfo16(HICON16 hIcon
, LPICONINFO16 iconinfo
)
190 BOOL16 ret
= GetIconInfo(HICON_32(hIcon
), &ii32
);
192 iconinfo
->fIcon
= ii32
.fIcon
;
193 iconinfo
->xHotspot
= ii32
.xHotspot
;
194 iconinfo
->yHotspot
= ii32
.yHotspot
;
195 iconinfo
->hbmMask
= HBITMAP_16(ii32
.hbmMask
);
196 iconinfo
->hbmColor
= HBITMAP_16(ii32
.hbmColor
);
200 /***********************************************************************
201 * CreateCursor (USER.406)
203 HCURSOR16 WINAPI
CreateCursor16(HINSTANCE16 hInstance
,
204 INT16 xHotSpot
, INT16 yHotSpot
,
205 INT16 nWidth
, INT16 nHeight
,
206 LPCVOID lpANDbits
, LPCVOID lpXORbits
)
210 info
.ptHotSpot
.x
= xHotSpot
;
211 info
.ptHotSpot
.y
= yHotSpot
;
212 info
.nWidth
= nWidth
;
213 info
.nHeight
= nHeight
;
214 info
.nWidthBytes
= 0;
216 info
.bBitsPerPixel
= 1;
218 return CreateCursorIconIndirect16(hInstance
, &info
, lpANDbits
, lpXORbits
);
221 /**********************************************************************
222 * CreateIconFromResourceEx (USER.450)
224 * FIXME: not sure about exact parameter types
226 HICON16 WINAPI
CreateIconFromResourceEx16(LPBYTE bits
, UINT16 cbSize
,
227 BOOL16 bIcon
, DWORD dwVersion
,
228 INT16 width
, INT16 height
,
231 return HICON_16(CreateIconFromResourceEx(bits
, cbSize
, bIcon
, dwVersion
,
232 width
, height
, cFlag
));
235 /***********************************************************************
236 * DestroyIcon (USER.457)
238 BOOL16 WINAPI
DestroyIcon16(HICON16 hIcon
)
240 return DestroyIcon32(hIcon
, 0);
243 /***********************************************************************
244 * DestroyCursor (USER.458)
246 BOOL16 WINAPI
DestroyCursor16(HCURSOR16 hCursor
)
248 return DestroyIcon32(hCursor
, 0);