source: trunk/src/user32/loadres.cpp@ 3419

Last change on this file since 3419 was 3419, checked in by sandervl, 25 years ago

misc updates

File size: 21.4 KB
Line 
1/* $Id: loadres.cpp,v 1.26 2000-04-18 11:12:59 sandervl 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, loader\resource.c, objects\cursoricon.c):
9 *
10 * Copyright 1993 Alexandre Julliard
11 * 1993 Robert J. Amstadt
12 * 1996 Martin Von Loewis
13 * 1997 Alex Korobka
14 * 1998 Turchanov Sergey
15 * 1998 Huw D M Davies
16 *
17 * Project Odin Software License can be found in LICENSE.TXT
18 *
19 */
20#include <os2win.h>
21#include <user32.h>
22#include <winres.h>
23#include <heapstring.h>
24#include <oslibres.h>
25#include <win\virtual.h>
26#include "dib.h"
27#include "initterm.h"
28#include <win\cursoricon.h>
29
30#define DBG_LOCALLOG DBG_loadres
31#include "dbglocal.h"
32
33//******************************************************************************
34//******************************************************************************
35INT WIN32API LoadStringA(HINSTANCE instance, UINT resource_id,
36 LPSTR buffer, INT buflen )
37{
38 INT retval;
39 LPWSTR buffer2 = NULL;
40
41 if (buffer && buflen)
42 buffer2 = (LPWSTR)HeapAlloc( GetProcessHeap(), 0, buflen * 2 );
43
44 retval = LoadStringW(instance,resource_id,buffer2,buflen);
45
46 if (buffer2)
47 {
48 if (retval) {
49 lstrcpynWtoA( buffer, buffer2, buflen );
50 retval = lstrlenA( buffer );
51 }
52 else
53 *buffer = 0;
54 HeapFree( GetProcessHeap(), 0, buffer2 );
55 }
56 return retval;
57}
58//******************************************************************************
59//******************************************************************************
60int WIN32API LoadStringW(HINSTANCE hinst, UINT wID, LPWSTR lpBuffer, int cchBuffer)
61{
62 Win32Resource *winres;
63 WCHAR *p;
64 int string_num;
65 int i = 0;
66
67 /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out
68 * 20 - 31. */
69 winres = (Win32Resource *)FindResourceW(hinst, (LPWSTR)(((wID>>4)&0xffff)+1), RT_STRINGW);
70 if(winres == NULL) {
71 dprintf(("LoadStringW NOT FOUND from %X, id %d buffersize %d\n", hinst, wID, cchBuffer));
72 *lpBuffer = 0;
73 return 0;
74 }
75
76 p = (LPWSTR)winres->lockResource();
77 if(p) {
78 string_num = wID & 0x000f;
79 for (i = 0; i < string_num; i++)
80 p += *p + 1;
81
82 if (lpBuffer == NULL) return *p;
83 i = min(cchBuffer - 1, *p);
84 if (i > 0) {
85 memcpy(lpBuffer, p + 1, i * sizeof (WCHAR));
86 lpBuffer[i] = (WCHAR) 0;
87 }
88 else {
89 if (cchBuffer > 1) {
90 lpBuffer[0] = (WCHAR) 0;
91 return 0;
92 }
93 }
94 }
95 delete winres;
96
97#ifdef DEBUG_ENABLELOG_LEVEL2
98 if(i) {
99 char *astring = (char *)HEAP_strdupWtoA(GetProcessHeap(), 0, lpBuffer);
100 dprintf(("LoadStringW from %X, id %d %s\n", hinst, wID, astring));
101 HEAP_free(astring);
102 }
103#else
104 dprintf(("LoadStringW from %X, id %d buffersize %d\n", hinst, wID, cchBuffer));
105#endif
106 return(i);
107}
108//******************************************************************************
109//******************************************************************************
110HICON LoadIconA(HINSTANCE hinst, LPCSTR lpszIcon, DWORD cxDesired,
111 DWORD cyDesired, DWORD fuLoad)
112{
113 Win32Resource *winres;
114 HICON hIcon;
115 HANDLE hMapping = 0;
116 char *ptr = NULL;
117
118 if(fuLoad & LR_LOADFROMFILE)
119 {
120 hMapping = VIRTUAL_MapFileA( lpszIcon, (LPVOID *)&ptr, TRUE);
121 if(hMapping == INVALID_HANDLE_VALUE)
122 return 0;
123 hIcon = OSLibWinCreatePointer(ptr);
124 CloseHandle(hMapping);
125 }
126 else
127 {
128 if(!hinst)
129 {
130 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_ICONA);
131 if(!winres)
132 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_GROUP_ICONA);
133 if(winres)
134 {
135 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
136 delete winres;
137 }
138 else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));
139 }
140 else
141 { //not a system icon
142 winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA);
143 if(winres == 0) {
144 winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_GROUP_ICONA);
145 }
146 if(winres) {
147 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
148 delete winres;
149 }
150 else hIcon = 0;
151 }
152 }
153 dprintf(("LoadIconA (%X) returned %x\n", hinst, hIcon));
154
155 return(hIcon);
156}
157//******************************************************************************
158//******************************************************************************
159HICON LoadIconW(HINSTANCE hinst, LPCWSTR lpszIcon, DWORD cxDesired,
160 DWORD cyDesired, DWORD fuLoad)
161{
162 Win32Resource *winres;
163 HICON hIcon;
164 HANDLE hMapping = 0;
165 char *ptr = NULL;
166
167 if(fuLoad & LR_LOADFROMFILE)
168 {
169 hMapping = VIRTUAL_MapFileW( lpszIcon, (LPVOID *)&ptr, TRUE);
170 if(hMapping == INVALID_HANDLE_VALUE)
171 return 0;
172 hIcon = OSLibWinCreatePointer(ptr);
173 CloseHandle(hMapping);
174 }
175 else
176 {
177 if (!hinst)
178 {
179 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_ICONW);
180 if(!winres)
181 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_GROUP_ICONW);
182 if(winres)
183 {
184 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
185 delete winres;
186 }
187 else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));
188 }
189 else
190 {//not a system icon
191 winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW);
192 if(winres == 0) {
193 winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_GROUP_ICONW);
194 }
195 if(winres) {
196 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
197 delete winres;
198 }
199 else hIcon = 0;
200 }
201 }
202 dprintf(("LoadIconW (%X) returned %x\n", hinst, hIcon));
203
204 return(hIcon);
205}
206//******************************************************************************
207//******************************************************************************
208HICON WIN32API LoadIconA(HINSTANCE hinst, LPCSTR lpszIcon)
209{
210 return LoadIconA(hinst, lpszIcon, 0, 0, 0);
211}
212//******************************************************************************
213//******************************************************************************
214HICON WIN32API LoadIconW(HINSTANCE hinst, LPCWSTR lpszIcon)
215{
216 return LoadIconW(hinst, lpszIcon, 0, 0, 0);
217}
218//******************************************************************************
219//******************************************************************************
220HCURSOR LoadCursorA(HINSTANCE hinst, LPCSTR lpszCursor, DWORD cxDesired,
221 DWORD cyDesired, DWORD fuLoad)
222{
223 Win32Resource *winres;
224 HCURSOR hCursor;
225 HANDLE hMapping = 0;
226 char *ptr = NULL;
227
228 if(fuLoad & LR_LOADFROMFILE)
229 {
230 hMapping = VIRTUAL_MapFileA( lpszCursor, (LPVOID *)&ptr, TRUE);
231 if(hMapping == INVALID_HANDLE_VALUE)
232 return 0;
233 hCursor = OSLibWinCreatePointer(ptr);
234 CloseHandle(hMapping);
235 }
236 else
237 {
238 if (!hinst)
239 {
240 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_CURSORA);
241 if(!winres)
242 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_GROUP_CURSORA);
243 if(winres)
244 {
245 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
246 delete winres;
247 }
248 else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR));
249 }
250 else
251 {//not a system pointer
252 winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA);
253 if(winres == 0) {
254 winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_GROUP_CURSORA);
255 }
256 if(winres) {
257 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
258 delete winres;
259 }
260 else hCursor = 0;
261 }
262 }
263 if(HIWORD(lpszCursor)) {
264 dprintf(("LoadCursorA %s from %x returned %x\n", lpszCursor, hinst, hCursor));
265 }
266 else dprintf(("LoadCursorA %x from %x returned %x\n", lpszCursor, hinst, hCursor));
267
268 return(hCursor);
269}
270//******************************************************************************
271//******************************************************************************
272HCURSOR LoadCursorW(HINSTANCE hinst, LPCWSTR lpszCursor, DWORD cxDesired,
273 DWORD cyDesired, DWORD fuLoad)
274{
275 Win32Resource *winres;
276 HCURSOR hCursor;
277 HANDLE hMapping = 0;
278 char *ptr = NULL;
279
280 if(fuLoad & LR_LOADFROMFILE)
281 {
282 hMapping = VIRTUAL_MapFileW( lpszCursor, (LPVOID *)&ptr, TRUE);
283 if(hMapping == INVALID_HANDLE_VALUE)
284 return 0;
285 hCursor = OSLibWinCreatePointer(ptr);
286 CloseHandle(hMapping);
287 }
288 else
289 {
290 if(!hinst)
291 {
292 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_CURSORW);
293 if(!winres)
294 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_GROUP_CURSORW);
295 if(winres)
296 {
297 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
298 delete winres;
299 }
300 else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR));
301 }
302 else
303 {//not a system pointer
304 winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW);
305 if(winres == 0) {
306 winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_GROUP_CURSORW);
307 }
308 if(winres) {
309 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
310 delete winres;
311 }
312 else hCursor = 0;
313 }
314 }
315 dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor));
316
317 return(hCursor);
318}
319//******************************************************************************
320//******************************************************************************
321HCURSOR WIN32API LoadCursorA(HINSTANCE hinst, LPCSTR lpszCursor)
322{
323 return LoadCursorA(hinst, lpszCursor, 0, 0, 0);
324}
325//******************************************************************************
326//******************************************************************************
327HCURSOR WIN32API LoadCursorW(HINSTANCE hinst, LPCWSTR lpszCursor)
328{
329 return LoadCursorW(hinst, lpszCursor, 0, 0, 0);
330}
331//******************************************************************************
332//******************************************************************************
333BOOL IsSystemBitmap(ULONG id)
334{
335 switch(id)
336 {
337 case OBM_UPARROW:
338 case OBM_DNARROW:
339 case OBM_RGARROW:
340 case OBM_LFARROW:
341 case OBM_RESTORE:
342 case OBM_RESTORED:
343 case OBM_UPARROWD:
344 case OBM_DNARROWD:
345 case OBM_RGARROWD:
346 case OBM_LFARROWD:
347 case OBM_OLD_UPARROW:
348 case OBM_OLD_DNARROW:
349 case OBM_OLD_RGARROW:
350 case OBM_OLD_LFARROW:
351 case OBM_CHECK:
352 case OBM_RADIOCHECK:
353 case OBM_CHECKBOXES:
354 case OBM_BTNCORNERS:
355 case OBM_COMBO:
356 case OBM_REDUCE:
357 case OBM_REDUCED:
358 case OBM_ZOOM:
359 case OBM_ZOOMD:
360 case OBM_SIZE:
361 case OBM_CLOSE:
362 case OBM_MNARROW:
363 case OBM_UPARROWI:
364 case OBM_DNARROWI:
365 case OBM_RGARROWI:
366 case OBM_LFARROWI:
367 case OBM_CLOSED:
368 case OBM_OLD_CLOSE:
369 case OBM_BTSIZE:
370 case OBM_OLD_REDUCE:
371 case OBM_OLD_ZOOM:
372 case OBM_OLD_RESTORE:
373 case OBM_CONTEXTHELP:
374 case OBM_CONTEXTHELPD:
375 return TRUE;
376
377 default:
378 return FALSE;
379 }
380}
381//******************************************************************************
382//NOTE: LR_CREATEDIBSECTION flag doesn't work (crash in GDI32)!
383//******************************************************************************
384HANDLE LoadBitmapA(HINSTANCE hinst, LPCSTR lpszName, int cxDesired, int cyDesired,
385 UINT fuLoad)
386{
387 HBITMAP hbitmap = 0;
388 HDC hdc;
389 HRSRC hRsrc;
390 HGLOBAL handle, hMapping = 0;
391 char *ptr = NULL;
392 BITMAPINFO *info, *fix_info=NULL;
393 HGLOBAL hFix;
394 int size;
395
396 if (!(fuLoad & LR_LOADFROMFILE)) {
397 if (!(hRsrc = FindResourceA( hinst, lpszName, RT_BITMAPA ))) return 0;
398 if (!(handle = LoadResource( hinst, hRsrc ))) return 0;
399
400 if ((info = (BITMAPINFO *)LockResource( handle )) == NULL) return 0;
401 }
402 else
403 {
404 hMapping = VIRTUAL_MapFileA( lpszName, (LPVOID *)&ptr, TRUE);
405 if (hMapping == INVALID_HANDLE_VALUE) return 0;
406 info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
407 }
408
409 //TODO: This has to be removed once pe2lx stores win32 resources!!!
410 if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER) &&
411 info->bmiHeader.biSize != sizeof(BITMAPINFOHEADER))
412 {//assume it contains a file header first
413 info = (BITMAPINFO *)((char *)info + sizeof(BITMAPFILEHEADER));
414 }
415
416 if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) {
417 size = sizeof(BITMAPINFOHEADER) +
418 (sizeof (RGBTRIPLE) << ((BITMAPCOREHEADER *)info)->bcBitCount);
419 } else
420 size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
421
422 if ((hFix = GlobalAlloc(0, size)) != NULL) fix_info = (BITMAPINFO *)GlobalLock(hFix);
423 if (fix_info) {
424 BYTE pix;
425
426 if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) {
427 ULONG colors;
428 ULONG *p, *q;
429
430 memset (fix_info, 0, sizeof (BITMAPINFOHEADER));
431 fix_info->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
432 fix_info->bmiHeader.biWidth = ((BITMAPCOREHEADER *)info)->bcWidth;
433 fix_info->bmiHeader.biHeight = ((BITMAPCOREHEADER *)info)->bcHeight;
434 fix_info->bmiHeader.biPlanes = ((BITMAPCOREHEADER *)info)->bcPlanes;
435 fix_info->bmiHeader.biBitCount = ((BITMAPCOREHEADER *)info)->bcBitCount;
436
437 p = (PULONG)((char *)info + sizeof(BITMAPCOREHEADER));
438 q = (PULONG)((char *)fix_info + sizeof(BITMAPINFOHEADER));
439 for (colors = 1 << fix_info->bmiHeader.biBitCount; colors > 0; colors--) {
440 *q = *p & 0x00FFFFFFUL;
441 q++;
442 p = (PULONG)((char *)p + sizeof (RGBTRIPLE));
443 }
444 } else
445 memcpy(fix_info, info, size);
446
447 size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
448 pix = *((LPBYTE)info + size);
449 DIB_FixColorsToLoadflags(fix_info, fuLoad, pix);
450 if ((hdc = GetDC(0)) != 0) {
451 char *bits = (char *)info + size;
452 if (fuLoad & LR_CREATEDIBSECTION) {
453 DIBSECTION dib;
454 hbitmap = CreateDIBSection(hdc, fix_info, DIB_RGB_COLORS, NULL, 0, 0);
455 GetObjectA(hbitmap, sizeof(DIBSECTION), &dib);
456 SetDIBits(hdc, hbitmap, 0, dib.dsBm.bmHeight, bits, info,
457 DIB_RGB_COLORS);
458 }
459 else {
460// if(fix_info->bmiHeader.biBitCount == 1) {
461// hbitmap = CreateBitmap(fix_info->bmiHeader.biWidth,
462// fix_info->bmiHeader.biHeight,
463// fix_info->bmiHeader.biPlanes,
464// fix_info->bmiHeader.biBitCount,
465// (PVOID)bits);
466// }
467// else {
468 hbitmap = CreateDIBitmap(hdc, &fix_info->bmiHeader, CBM_INIT,
469 bits, fix_info, DIB_RGB_COLORS );
470// }
471 }
472 ReleaseDC( 0, hdc );
473 }
474 GlobalUnlock(hFix);
475 GlobalFree(hFix);
476 }
477 if (fuLoad & LR_LOADFROMFILE) CloseHandle( hMapping );
478 return hbitmap;
479}
480//******************************************************************************
481//TODO: No support for RT_NEWBITMAP
482//******************************************************************************
483HBITMAP WIN32API LoadBitmapA(HINSTANCE hinst, LPCSTR lpszBitmap)
484{
485 HBITMAP hBitmap = 0;
486
487 if (!hinst)
488 {
489 if(IsSystemBitmap((ULONG)lpszBitmap))
490 {
491 hBitmap = LoadBitmapA(hInstanceUser32, lpszBitmap, 0, 0, 0);
492 }
493 }
494 if(!hBitmap)
495 hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0);
496
497 dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
498
499 return(hBitmap);
500}
501//******************************************************************************
502//TODO: No support for RT_NEWBITMAP
503//******************************************************************************
504HBITMAP WIN32API LoadBitmapW(HINSTANCE hinst, LPCWSTR lpszBitmap)
505{
506 HBITMAP hBitmap = 0;
507
508 if(HIWORD(lpszBitmap) != 0)
509 lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
510
511 hBitmap = LoadBitmapA((hinst == 0) ? hInstanceUser32:hinst, (LPSTR)lpszBitmap, 0, 0, 0);
512
513 if(HIWORD(lpszBitmap) != 0)
514 FreeAsciiString((LPSTR)lpszBitmap);
515
516 dprintf(("LoadBitmapW returned %08xh\n", hBitmap));
517
518 return(hBitmap);
519}
520//******************************************************************************
521//TODO: Far from complete, but works for loading resources from exe
522//fuLoad flag ignored
523//******************************************************************************
524HANDLE WIN32API LoadImageA(HINSTANCE hinst, LPCSTR lpszName, UINT uType,
525 int cxDesired, int cyDesired, UINT fuLoad)
526{
527 HANDLE hRet = 0;
528
529 if(HIWORD(lpszName)) {
530 dprintf(("LoadImageA NOT COMPLETE %x %s %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
531 }
532 else dprintf(("LoadImageA NOT COMPLETE %x %x %d (%d,%d)\n", hinst, lpszName, uType, cxDesired, cyDesired));
533
534 if(fuLoad & LR_DEFAULTSIZE) {
535 if (uType == IMAGE_ICON) {
536 if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
537 if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
538 }
539 else if (uType == IMAGE_CURSOR) {
540 if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
541 if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
542 }
543 }
544 if (fuLoad & LR_LOADFROMFILE) fuLoad &= ~LR_SHARED;
545
546 switch(uType) {
547 case IMAGE_BITMAP:
548 hRet = (HANDLE)LoadBitmapA(hinst, lpszName, cxDesired, cyDesired, fuLoad);
549 break;
550 case IMAGE_CURSOR:
551 hRet = (HANDLE)LoadCursorA(hinst, lpszName, cxDesired, cyDesired, fuLoad);
552 break;
553 case IMAGE_ICON:
554 hRet = (HANDLE)LoadIconA(hinst, lpszName, cxDesired, cyDesired, fuLoad);
555 break;
556 default:
557 dprintf(("LoadImageA: unsupported type %d!!", uType));
558 return 0;
559 }
560 dprintf(("LoadImageA returned %d\n", (int)hRet));
561
562 return(hRet);
563}
564//******************************************************************************
565//******************************************************************************
566HANDLE WIN32API LoadImageW(HINSTANCE hinst, LPCWSTR lpszName, UINT uType,
567 int cxDesired, int cyDesired, UINT fuLoad)
568{
569 HANDLE hRet = 0;
570
571 dprintf(("LoadImageW NOT COMPLETE (%d,%d)\n", cxDesired, cyDesired));
572
573 if (fuLoad & LR_DEFAULTSIZE) {
574 if (uType == IMAGE_ICON) {
575 if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
576 if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
577 }
578 else if (uType == IMAGE_CURSOR) {
579 if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
580 if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
581 }
582 }
583 if (fuLoad & LR_LOADFROMFILE) fuLoad &= ~LR_SHARED;
584
585 switch(uType) {
586 case IMAGE_BITMAP:
587 hRet = (HANDLE)LoadBitmapW(hinst, lpszName);
588 break;
589 case IMAGE_CURSOR:
590 hRet = (HANDLE)LoadCursorW(hinst, lpszName, cxDesired, cyDesired, fuLoad);
591 break;
592 case IMAGE_ICON:
593 hRet = (HANDLE)LoadIconW(hinst, lpszName, cxDesired, cyDesired, fuLoad);
594 break;
595 default:
596 dprintf(("LoadImageW: unsupported type %d!!", uType));
597 return 0;
598 }
599 dprintf(("LoadImageW returned %d\n", (int)hRet));
600
601 return(hRet);
602}
603/******************************************************************************
604 * CopyImage32 [USER32.61] Creates new image and copies attributes to it
605 *
606 * PARAMS
607 * hnd [I] Handle to image to copy
608 * type [I] Type of image to copy
609 * desiredx [I] Desired width of new image
610 * desiredy [I] Desired height of new image
611 * flags [I] Copy flags
612 *
613 * RETURNS
614 * Success: Handle to newly created image
615 * Failure: NULL
616 *
617 * FIXME: implementation still lacks nearly all features, see LR_*
618 * defines in windows.h
619 *
620 */
621HICON WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
622 INT desiredy, UINT flags )
623{
624 dprintf(("CopyImage %x %d (%d,%d) %x", hnd, type, desiredx, desiredy, flags));
625 switch (type)
626 {
627// case IMAGE_BITMAP:
628// return BITMAP_CopyBitmap(hnd);
629 case IMAGE_ICON:
630 return CopyIcon(hnd);
631 case IMAGE_CURSOR:
632 return CopyCursor(hnd);
633// return CopyCursorIcon(hnd,type, desiredx, desiredy, flags);
634 default:
635 dprintf(("CopyImage: Unsupported type"));
636 }
637 return 0;
638}
639//******************************************************************************
640//******************************************************************************
Note: See TracBrowser for help on using the repository browser.