1 | /* $Id: loadres.cpp,v 1.12 1999-11-04 13:02:49 phaller Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 resource API functions for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1998 Sander van Leeuwen
|
---|
7 | *
|
---|
8 | * Parts based on Wine code (objects\bitmap.c):
|
---|
9 | *
|
---|
10 | * Copyright 1993 Alexandre Julliard
|
---|
11 | * 1998 Huw D M Davies
|
---|
12 | *
|
---|
13 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
14 | *
|
---|
15 | */
|
---|
16 | #include <os2win.h>
|
---|
17 | #include <user32.h>
|
---|
18 | #include <winres.h>
|
---|
19 | #include <heapstring.h>
|
---|
20 | #include <oslibres.h>
|
---|
21 | #include <winconst.h>
|
---|
22 | #include <win\virtual.h>
|
---|
23 | #include "dib.h"
|
---|
24 |
|
---|
25 | //******************************************************************************
|
---|
26 | //******************************************************************************
|
---|
27 | int WIN32API LoadStringA(HINSTANCE hinst, UINT wID, LPSTR lpBuffer, int cchBuffer)
|
---|
28 | {
|
---|
29 | Win32Resource *winres;
|
---|
30 | LPWSTR resstring;
|
---|
31 | int resstrlen = 0;
|
---|
32 |
|
---|
33 | winres = (Win32Resource *)FindResourceA(hinst, (LPSTR)wID, RT_STRINGA);
|
---|
34 | if(winres == NULL) {
|
---|
35 | dprintf(("LoadStringA NOT FOUND from %X, id %d buffersize %d\n", hinst, wID, cchBuffer));
|
---|
36 | *lpBuffer = 0;
|
---|
37 | return 0;
|
---|
38 | }
|
---|
39 |
|
---|
40 | resstring = (LPWSTR)winres->lockResource();
|
---|
41 | if(resstring) {
|
---|
42 | resstrlen = min(lstrlenW(resstring)+1, cchBuffer);
|
---|
43 | lstrcpynWtoA(lpBuffer, resstring, resstrlen);
|
---|
44 | lpBuffer[resstrlen-1] = 0;
|
---|
45 | resstrlen--;
|
---|
46 | dprintf(("LoadStringA (%d) %s", resstrlen, lpBuffer));
|
---|
47 | }
|
---|
48 | delete winres;
|
---|
49 |
|
---|
50 | dprintf(("LoadStringA from %X, id %d buffersize %d\n", hinst, wID, cchBuffer));
|
---|
51 | return(resstrlen);
|
---|
52 | }
|
---|
53 | //******************************************************************************
|
---|
54 | //******************************************************************************
|
---|
55 | int WIN32API LoadStringW(HINSTANCE hinst, UINT wID, LPWSTR lpBuffer, int cchBuffer)
|
---|
56 | {
|
---|
57 | Win32Resource *winres;
|
---|
58 | LPWSTR resstring;
|
---|
59 | int resstrlen = 0;
|
---|
60 |
|
---|
61 | winres = (Win32Resource *)FindResourceW(hinst, (LPWSTR)wID, RT_STRINGW);
|
---|
62 | if(winres == NULL) {
|
---|
63 | dprintf(("LoadStringW NOT FOUND from %X, id %d buffersize %d\n", hinst, wID, cchBuffer));
|
---|
64 | *lpBuffer = 0;
|
---|
65 | return 0;
|
---|
66 | }
|
---|
67 |
|
---|
68 | resstring = (LPWSTR)winres->lockResource();
|
---|
69 | if(resstring) {
|
---|
70 | resstrlen = min(lstrlenW(resstring)+1, cchBuffer);
|
---|
71 | lstrcpynW(lpBuffer, resstring, resstrlen);
|
---|
72 | lpBuffer[resstrlen-1] = 0;
|
---|
73 | resstrlen--;
|
---|
74 | }
|
---|
75 | delete winres;
|
---|
76 |
|
---|
77 | dprintf(("LoadStringW from %X, id %d buffersize %d\n", hinst, wID, cchBuffer));
|
---|
78 | return(resstrlen);
|
---|
79 | }
|
---|
80 | //******************************************************************************
|
---|
81 | //******************************************************************************
|
---|
82 | HICON WIN32API LoadIconA(HINSTANCE hinst, LPCSTR lpszIcon)
|
---|
83 | {
|
---|
84 | Win32Resource *winres;
|
---|
85 | HICON hIcon;
|
---|
86 |
|
---|
87 | hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
|
---|
88 | if(hIcon == 0) {//not a system icon
|
---|
89 | winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA);
|
---|
90 | if(winres == 0) {
|
---|
91 | winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_GROUP_ICONA);
|
---|
92 | }
|
---|
93 | if(winres) {
|
---|
94 | hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
|
---|
95 | delete winres;
|
---|
96 | }
|
---|
97 | }
|
---|
98 | dprintf(("LoadIconA (%X) returned %x\n", hinst, hIcon));
|
---|
99 |
|
---|
100 | return(hIcon);
|
---|
101 | }
|
---|
102 | //******************************************************************************
|
---|
103 | //******************************************************************************
|
---|
104 | HICON WIN32API LoadIconW(HINSTANCE hinst, LPCWSTR lpszIcon)
|
---|
105 | {
|
---|
106 | Win32Resource *winres;
|
---|
107 | HICON hIcon;
|
---|
108 |
|
---|
109 | hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
|
---|
110 | if(hIcon == 0) {//not a system icon
|
---|
111 | winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW);
|
---|
112 | if(winres == 0) {
|
---|
113 | winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_GROUP_ICONW);
|
---|
114 | }
|
---|
115 | if(winres) {
|
---|
116 | hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
|
---|
117 | delete winres;
|
---|
118 | }
|
---|
119 | }
|
---|
120 | dprintf(("LoadIconW (%X) returned %x\n", hinst, hIcon));
|
---|
121 |
|
---|
122 | return(hIcon);
|
---|
123 | }
|
---|
124 | //******************************************************************************
|
---|
125 | //******************************************************************************
|
---|
126 | HCURSOR WIN32API LoadCursorA(HINSTANCE hinst, LPCSTR lpszCursor)
|
---|
127 | {
|
---|
128 | Win32Resource *winres;
|
---|
129 | HCURSOR hCursor;
|
---|
130 |
|
---|
131 | hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
|
---|
132 | if(hCursor == 0) {//not a system pointer
|
---|
133 | winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA);
|
---|
134 | if(winres == 0) {
|
---|
135 | winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_GROUP_CURSORA);
|
---|
136 | }
|
---|
137 | if(winres) {
|
---|
138 | hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
|
---|
139 | delete winres;
|
---|
140 | }
|
---|
141 | }
|
---|
142 | if(HIWORD(lpszCursor)) {
|
---|
143 | dprintf(("LoadCursorA %s from %x returned %x\n", lpszCursor, hinst, hCursor));
|
---|
144 | }
|
---|
145 | else dprintf(("LoadCursorA %x from %x returned %x\n", lpszCursor, hinst, hCursor));
|
---|
146 |
|
---|
147 | return(hCursor);
|
---|
148 | }
|
---|
149 | //******************************************************************************
|
---|
150 | //******************************************************************************
|
---|
151 | HCURSOR WIN32API LoadCursorW(HINSTANCE hinst, LPCWSTR lpszCursor)
|
---|
152 | {
|
---|
153 | Win32Resource *winres;
|
---|
154 | HCURSOR hCursor;
|
---|
155 |
|
---|
156 | hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
|
---|
157 | if(hCursor == 0) {//not a system pointer
|
---|
158 | winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW);
|
---|
159 | if(winres == 0) {
|
---|
160 | winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_GROUP_CURSORW);
|
---|
161 | }
|
---|
162 | if(winres) {
|
---|
163 | hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
|
---|
164 | delete winres;
|
---|
165 | }
|
---|
166 | }
|
---|
167 | dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor));
|
---|
168 |
|
---|
169 | return(hCursor);
|
---|
170 | }
|
---|
171 | //******************************************************************************
|
---|
172 | //******************************************************************************
|
---|
173 | BOOL IsSystemBitmap(ULONG *id)
|
---|
174 | {
|
---|
175 | switch(*id)
|
---|
176 | {
|
---|
177 | case OBM_UPARROW_W:
|
---|
178 | case OBM_DNARROW_W:
|
---|
179 | case OBM_RGARROW_W:
|
---|
180 | case OBM_LFARROW_W:
|
---|
181 | case OBM_RESTORE_W:
|
---|
182 | case OBM_RESTORED_W:
|
---|
183 | case OBM_UPARROWD_W:
|
---|
184 | case OBM_DNARROWD_W:
|
---|
185 | case OBM_RGARROWD_W:
|
---|
186 | case OBM_LFARROWD_W:
|
---|
187 | case OBM_OLD_UPARROW_W:
|
---|
188 | case OBM_OLD_DNARROW_W:
|
---|
189 | case OBM_OLD_RGARROW_W:
|
---|
190 | case OBM_OLD_LFARROW_W:
|
---|
191 | case OBM_CHECK_W:
|
---|
192 | case OBM_CHECKBOXES_W:
|
---|
193 | case OBM_BTNCORNERS_W:
|
---|
194 | case OBM_COMBO_W:
|
---|
195 | case OBM_REDUCE_W:
|
---|
196 | case OBM_REDUCED_W:
|
---|
197 | case OBM_ZOOM_W:
|
---|
198 | case OBM_ZOOMD_W:
|
---|
199 | case OBM_SIZE_W:
|
---|
200 | case OBM_CLOSE_W:
|
---|
201 | case OBM_MNARROW_W:
|
---|
202 | case OBM_UPARROWI_W:
|
---|
203 | case OBM_DNARROWI_W:
|
---|
204 | case OBM_RGARROWI_W:
|
---|
205 | case OBM_LFARROWI_W:
|
---|
206 | return TRUE;
|
---|
207 |
|
---|
208 | //TODO: Not supported by Open32. Replacement may not be accurate
|
---|
209 | case OBM_OLD_CLOSE_W:
|
---|
210 | *id = OBM_CLOSE_W;
|
---|
211 | return TRUE;
|
---|
212 |
|
---|
213 | case OBM_BTSIZE_W:
|
---|
214 | *id = OBM_SIZE_W;
|
---|
215 | return TRUE;
|
---|
216 |
|
---|
217 | case OBM_OLD_REDUCE_W:
|
---|
218 | *id = OBM_REDUCE_W;
|
---|
219 | return TRUE;
|
---|
220 |
|
---|
221 | case OBM_OLD_ZOOM_W:
|
---|
222 | *id = OBM_ZOOM_W;
|
---|
223 | return TRUE;
|
---|
224 |
|
---|
225 | case OBM_OLD_RESTORE_W:
|
---|
226 | *id = OBM_RESTORE_W;
|
---|
227 | return TRUE;
|
---|
228 |
|
---|
229 | default:
|
---|
230 | return FALSE;
|
---|
231 | }
|
---|
232 | }
|
---|
233 | //******************************************************************************
|
---|
234 | //NOTE: LR_CREATEDIBSECTION flag doesn't work (crash in GDI32)!
|
---|
235 | //******************************************************************************
|
---|
236 | HANDLE LoadBitmapA(HINSTANCE hinst, LPCSTR lpszName, int cxDesired, int cyDesired,
|
---|
237 | UINT fuLoad)
|
---|
238 | {
|
---|
239 | HBITMAP hbitmap = 0;
|
---|
240 | HDC hdc;
|
---|
241 | HRSRC hRsrc;
|
---|
242 | HGLOBAL handle, hMapping = 0;
|
---|
243 | char *ptr = NULL;
|
---|
244 | BITMAPINFO *info, *fix_info=NULL;
|
---|
245 | HGLOBAL hFix;
|
---|
246 | int size;
|
---|
247 |
|
---|
248 | if (!(fuLoad & LR_LOADFROMFILE)) {
|
---|
249 | if (!(hRsrc = FindResourceA( hinst, lpszName, RT_BITMAPA ))) return 0;
|
---|
250 | if (!(handle = LoadResource( hinst, hRsrc ))) return 0;
|
---|
251 |
|
---|
252 | if ((info = (BITMAPINFO *)LockResource( handle )) == NULL) return 0;
|
---|
253 | }
|
---|
254 | else
|
---|
255 | {
|
---|
256 | hMapping = VIRTUAL_MapFileA( lpszName, (LPVOID *)&ptr);
|
---|
257 | if (hMapping == INVALID_HANDLE_VALUE) return 0;
|
---|
258 | info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
|
---|
259 | }
|
---|
260 |
|
---|
261 | //TODO: This has to be removed once pe2lx stores win32 resources!!!
|
---|
262 | if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER) &&
|
---|
263 | info->bmiHeader.biSize != sizeof(BITMAPINFOHEADER))
|
---|
264 | {//assume it contains a file header first
|
---|
265 | info = (BITMAPINFO *)((char *)info + sizeof(BITMAPFILEHEADER));
|
---|
266 | }
|
---|
267 |
|
---|
268 | if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) {
|
---|
269 | size = sizeof(BITMAPINFOHEADER) +
|
---|
270 | (sizeof (RGBTRIPLE) << ((BITMAPCOREHEADER *)info)->bcBitCount);
|
---|
271 | } else
|
---|
272 | size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
|
---|
273 |
|
---|
274 | if ((hFix = GlobalAlloc(0, size)) != NULL) fix_info = (BITMAPINFO *)GlobalLock(hFix);
|
---|
275 | if (fix_info) {
|
---|
276 | BYTE pix;
|
---|
277 |
|
---|
278 | if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) {
|
---|
279 | ULONG colors;
|
---|
280 | ULONG *p, *q;
|
---|
281 |
|
---|
282 | memset (fix_info, 0, sizeof (BITMAPINFOHEADER));
|
---|
283 | fix_info->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
|
---|
284 | fix_info->bmiHeader.biWidth = ((BITMAPCOREHEADER *)info)->bcWidth;
|
---|
285 | fix_info->bmiHeader.biHeight = ((BITMAPCOREHEADER *)info)->bcHeight;
|
---|
286 | fix_info->bmiHeader.biPlanes = ((BITMAPCOREHEADER *)info)->bcPlanes;
|
---|
287 | fix_info->bmiHeader.biBitCount = ((BITMAPCOREHEADER *)info)->bcBitCount;
|
---|
288 |
|
---|
289 | p = (PULONG)((char *)info + sizeof(BITMAPCOREHEADER));
|
---|
290 | q = (PULONG)((char *)fix_info + sizeof(BITMAPINFOHEADER));
|
---|
291 | for (colors = 1 << fix_info->bmiHeader.biBitCount; colors > 0; colors--) {
|
---|
292 | *q = *p & 0x00FFFFFFUL;
|
---|
293 | q++;
|
---|
294 | p = (PULONG)((char *)p + sizeof (RGBTRIPLE));
|
---|
295 | }
|
---|
296 | } else
|
---|
297 | memcpy(fix_info, info, size);
|
---|
298 |
|
---|
299 | size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
|
---|
300 | pix = *((LPBYTE)info + size);
|
---|
301 | DIB_FixColorsToLoadflags(fix_info, fuLoad, pix);
|
---|
302 | if ((hdc = GetDC(0)) != 0) {
|
---|
303 | char *bits = (char *)info + size;
|
---|
304 | if (fuLoad & LR_CREATEDIBSECTION) {
|
---|
305 | DIBSECTION dib;
|
---|
306 | hbitmap = CreateDIBSection(hdc, fix_info, DIB_RGB_COLORS, NULL, 0, 0);
|
---|
307 | GetObjectA(hbitmap, sizeof(DIBSECTION), &dib);
|
---|
308 | SetDIBits(hdc, hbitmap, 0, dib.dsBm.bmHeight, bits, info,
|
---|
309 | DIB_RGB_COLORS);
|
---|
310 | }
|
---|
311 | else {
|
---|
312 | hbitmap = CreateDIBitmap( hdc, &fix_info->bmiHeader, CBM_INIT,
|
---|
313 | bits, fix_info, DIB_RGB_COLORS );
|
---|
314 | }
|
---|
315 | ReleaseDC( 0, hdc );
|
---|
316 | }
|
---|
317 | GlobalUnlock(hFix);
|
---|
318 | GlobalFree(hFix);
|
---|
319 | }
|
---|
320 | if (fuLoad & LR_LOADFROMFILE) CloseHandle( hMapping );
|
---|
321 | return hbitmap;
|
---|
322 | }
|
---|
323 | //******************************************************************************
|
---|
324 | //TODO: No support for RT_NEWBITMAP
|
---|
325 | //******************************************************************************
|
---|
326 | HBITMAP WIN32API LoadBitmapA(HINSTANCE hinst, LPCSTR lpszBitmap)
|
---|
327 | {
|
---|
328 | HBITMAP hBitmap = 0;
|
---|
329 |
|
---|
330 | if(IsSystemBitmap((ULONG *)&lpszBitmap)) {
|
---|
331 | hBitmap = O32_LoadBitmap(hinst, lpszBitmap);
|
---|
332 | }
|
---|
333 | if(!hBitmap) {
|
---|
334 | hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);
|
---|
335 | }
|
---|
336 | dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
|
---|
337 |
|
---|
338 | return(hBitmap);
|
---|
339 | }
|
---|
340 | //******************************************************************************
|
---|
341 | //TODO: No support for RT_NEWBITMAP
|
---|
342 | //******************************************************************************
|
---|
343 | HBITMAP WIN32API LoadBitmapW(HINSTANCE hinst, LPCWSTR lpszBitmap)
|
---|
344 | {
|
---|
345 | HBITMAP hBitmap = 0;
|
---|
346 |
|
---|
347 | if(IsSystemBitmap((ULONG *)&lpszBitmap)) {
|
---|
348 | hBitmap = O32_LoadBitmap(hinst, (LPCSTR)lpszBitmap);
|
---|
349 | }
|
---|
350 | if(!hBitmap) {
|
---|
351 | if(HIWORD(lpszBitmap) != 0) {
|
---|
352 | lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
|
---|
353 | }
|
---|
354 | hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0);
|
---|
355 | }
|
---|
356 |
|
---|
357 | if(HIWORD(lpszBitmap) != 0)
|
---|
358 | FreeAsciiString((LPSTR)lpszBitmap);
|
---|
359 |
|
---|
360 | dprintf(("LoadBitmapW returned %08xh\n", hBitmap));
|
---|
361 |
|
---|
362 | return(hBitmap);
|
---|
363 | }
|
---|
364 | //******************************************************************************
|
---|
365 | //TODO: Far from complete, but works for loading resources from exe
|
---|
366 | //fuLoad flag ignored
|
---|
367 | //******************************************************************************
|
---|
368 | HANDLE WIN32API LoadImageA(HINSTANCE hinst, LPCSTR lpszName, UINT uType,
|
---|
369 | int cxDesired, int cyDesired, UINT fuLoad)
|
---|
370 | {
|
---|
371 | HANDLE hRet = 0;
|
---|
372 |
|
---|
373 | if(HIWORD(lpszName)) {
|
---|
374 | dprintf(("LoadImageA NOT COMPLETE %x %s %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
|
---|
375 | }
|
---|
376 | else dprintf(("LoadImageA NOT COMPLETE %x %x %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
|
---|
377 |
|
---|
378 | if (fuLoad & LR_DEFAULTSIZE) {
|
---|
379 | if (uType == IMAGE_ICON) {
|
---|
380 | if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
|
---|
381 | if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
|
---|
382 | }
|
---|
383 | else if (uType == IMAGE_CURSOR) {
|
---|
384 | if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
|
---|
385 | if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
|
---|
386 | }
|
---|
387 | }
|
---|
388 | if (fuLoad & LR_LOADFROMFILE) fuLoad &= ~LR_SHARED;
|
---|
389 |
|
---|
390 | switch(uType) {
|
---|
391 | case IMAGE_BITMAP:
|
---|
392 | hRet = (HANDLE)LoadBitmapA(hinst, lpszName, cxDesired, cyDesired, fuLoad);
|
---|
393 | break;
|
---|
394 | case IMAGE_CURSOR:
|
---|
395 | hRet = (HANDLE)LoadCursorA(hinst, lpszName);
|
---|
396 | break;
|
---|
397 | case IMAGE_ICON:
|
---|
398 | hRet = (HANDLE)LoadIconA(hinst, lpszName);
|
---|
399 | break;
|
---|
400 | default:
|
---|
401 | dprintf(("LoadImageA: unsupported type %d!!", uType));
|
---|
402 | return 0;
|
---|
403 | }
|
---|
404 | dprintf(("LoadImageA returned %d\n", (int)hRet));
|
---|
405 |
|
---|
406 | return(hRet);
|
---|
407 | }
|
---|
408 | //******************************************************************************
|
---|
409 | //******************************************************************************
|
---|
410 | HANDLE WIN32API LoadImageW(HINSTANCE hinst, LPCWSTR lpszName, UINT uType,
|
---|
411 | int cxDesired, int cyDesired, UINT fuLoad)
|
---|
412 | {
|
---|
413 | HANDLE hRet = 0;
|
---|
414 |
|
---|
415 | dprintf(("LoadImageW NOT COMPLETE (%d,%d)\n", cxDesired, cyDesired));
|
---|
416 |
|
---|
417 | if (fuLoad & LR_DEFAULTSIZE) {
|
---|
418 | if (uType == IMAGE_ICON) {
|
---|
419 | if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
|
---|
420 | if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
|
---|
421 | }
|
---|
422 | else if (uType == IMAGE_CURSOR) {
|
---|
423 | if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
|
---|
424 | if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
|
---|
425 | }
|
---|
426 | }
|
---|
427 | if (fuLoad & LR_LOADFROMFILE) fuLoad &= ~LR_SHARED;
|
---|
428 |
|
---|
429 | switch(uType) {
|
---|
430 | case IMAGE_BITMAP:
|
---|
431 | hRet = (HANDLE)LoadBitmapW(hinst, lpszName);
|
---|
432 | break;
|
---|
433 | case IMAGE_CURSOR:
|
---|
434 | hRet = (HANDLE)LoadCursorW(hinst, lpszName);
|
---|
435 | break;
|
---|
436 | case IMAGE_ICON:
|
---|
437 | hRet = (HANDLE)LoadIconW(hinst, lpszName);
|
---|
438 | break;
|
---|
439 | default:
|
---|
440 | dprintf(("LoadImageW: unsupported type %d!!", uType));
|
---|
441 | return 0;
|
---|
442 | }
|
---|
443 | dprintf(("LoadImageW returned %d\n", (int)hRet));
|
---|
444 |
|
---|
445 | return(hRet);
|
---|
446 | }
|
---|
447 | /******************************************************************************
|
---|
448 | * CopyImage32 [USER32.61] Creates new image and copies attributes to it
|
---|
449 | *
|
---|
450 | * PARAMS
|
---|
451 | * hnd [I] Handle to image to copy
|
---|
452 | * type [I] Type of image to copy
|
---|
453 | * desiredx [I] Desired width of new image
|
---|
454 | * desiredy [I] Desired height of new image
|
---|
455 | * flags [I] Copy flags
|
---|
456 | *
|
---|
457 | * RETURNS
|
---|
458 | * Success: Handle to newly created image
|
---|
459 | * Failure: NULL
|
---|
460 | *
|
---|
461 | * FIXME: implementation still lacks nearly all features, see LR_*
|
---|
462 | * defines in windows.h
|
---|
463 | *
|
---|
464 | */
|
---|
465 | HICON WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
|
---|
466 | INT desiredy, UINT flags )
|
---|
467 | {
|
---|
468 | dprintf(("CopyImage %x %d (%d,%d) %x", hnd, type, desiredx, desiredy, flags));
|
---|
469 | switch (type)
|
---|
470 | {
|
---|
471 | // case IMAGE_BITMAP:
|
---|
472 | // return BITMAP_CopyBitmap(hnd);
|
---|
473 | case IMAGE_ICON:
|
---|
474 | return CopyIcon(hnd);
|
---|
475 | case IMAGE_CURSOR:
|
---|
476 | return CopyCursor(hnd);
|
---|
477 | default:
|
---|
478 | dprintf(("CopyImage: Unsupported type"));
|
---|
479 | }
|
---|
480 | return 0;
|
---|
481 | }
|
---|
482 | //******************************************************************************
|
---|
483 | //******************************************************************************
|
---|