Changeset 601 for trunk/src/user32/new/loadres.cpp
- Timestamp:
- Aug 20, 1999, 10:09:51 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/loadres.cpp
r599 r601 1 /* $Id: loadres.cpp,v 1. 6 1999-08-20 15:03:41sandervl Exp $ */1 /* $Id: loadres.cpp,v 1.7 1999-08-20 20:09:50 sandervl Exp $ */ 2 2 3 3 /* … … 14 14 #include <winres.h> 15 15 #include <heapstring.h> 16 #include <oslibres.h> 16 17 17 18 //****************************************************************************** … … 72 73 HICON WIN32API LoadIconA(HINSTANCE hinst, LPCSTR lpszIcon) 73 74 { 74 HICON rc; 75 76 rc = (HICON)FindResourceA(hinst, lpszIcon, RT_ICONA); 77 dprintf(("LoadIconA (%X) returned %d\n", hinst, rc)); 78 return(rc); 75 Win32Resource *winres; 76 HICON hIcon; 77 78 hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon); 79 if(hIcon == 0) {//not a system icon 80 winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA); 81 if(winres == 0) { 82 winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_GROUP_ICONA); 83 } 84 if(winres) { 85 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 86 delete winres; 87 } 88 } 89 dprintf(("LoadIconA (%X) returned %x\n", hinst, hIcon)); 90 91 return(hIcon); 79 92 } 80 93 //****************************************************************************** … … 82 95 HICON WIN32API LoadIconW(HINSTANCE hinst, LPCWSTR lpszIcon) 83 96 { 84 HICON rc; 85 86 rc = (HICON)FindResourceW(hinst, lpszIcon, RT_ICONW); 87 dprintf(("LoadIconW (%X) returned %d\n", hinst, rc)); 88 return(rc); 97 Win32Resource *winres; 98 HICON hIcon; 99 100 hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon); 101 if(hIcon == 0) {//not a system icon 102 winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW); 103 if(winres == 0) { 104 winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_GROUP_ICONW); 105 } 106 if(winres) { 107 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 108 delete winres; 109 } 110 } 111 dprintf(("LoadIconW (%X) returned %x\n", hinst, hIcon)); 112 113 return(hIcon); 89 114 } 90 115 //****************************************************************************** … … 92 117 HCURSOR WIN32API LoadCursorA(HINSTANCE hinst, LPCSTR lpszCursor) 93 118 { 94 HCURSOR rc; 95 96 if((int)lpszCursor >> 16 != 0) {//convert string name identifier to numeric id 97 dprintf(("LoadCursor %s\n", lpszCursor)); 98 lpszCursor = (LPCSTR)ConvertNameId(hinst, (char *)lpszCursor); 99 } 100 else dprintf(("LoadCursor %d\n", (int)lpszCursor)); 101 102 rc = O32_LoadCursor(hinst, lpszCursor); 103 104 dprintf(("LoadCursor from %X returned %d\n", hinst, rc)); 105 return(rc); 119 Win32Resource *winres; 120 HCURSOR hCursor; 121 122 hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor); 123 if(hCursor == 0) {//not a system pointer 124 winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA); 125 if(winres == 0) { 126 winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_GROUP_CURSORA); 127 } 128 if(winres) { 129 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 130 delete winres; 131 } 132 } 133 dprintf(("LoadCursorA (%X) returned %x\n", hinst, hCursor)); 134 135 return(hCursor); 136 } 137 //****************************************************************************** 138 //****************************************************************************** 139 HCURSOR WIN32API LoadCursorW(HINSTANCE hinst, LPCWSTR lpszCursor) 140 { 141 Win32Resource *winres; 142 HCURSOR hCursor; 143 144 hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor); 145 if(hCursor == 0) {//not a system pointer 146 winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW); 147 if(winres == 0) { 148 winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_GROUP_CURSORW); 149 } 150 if(winres) { 151 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 152 delete winres; 153 } 154 } 155 dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor)); 156 157 return(hCursor); 106 158 } 107 159 //****************************************************************************** … … 111 163 HBITMAP rc; 112 164 113 if((int)lpszBitmap >> 16 != 0) 114 { //convert string name identifier to numeric id 115 dprintf(("lpszBitmap [%s]\n", 116 lpszBitmap)); 165 if(HIWORD(lpszBitmap) != 0) 166 { //convert string name identifier to numeric id 167 dprintf(("lpszBitmap [%s]\n", lpszBitmap)); 117 168 118 lpszBitmap = (LPCSTR)ConvertNameId(hinst, 119 (char *)lpszBitmap); 169 lpszBitmap = (LPCSTR)ConvertNameId(hinst, (char *)lpszBitmap); 120 170 } 121 else 122 dprintf(("lpszBitmap %08xh\n", 123 (int)lpszBitmap)); 171 else dprintf(("lpszBitmap %08xh\n", (int)lpszBitmap)); 124 172 125 173 rc = O32_LoadBitmap(hinst, lpszBitmap); 126 174 127 dprintf(("LoadBitmapA returned %08xh\n", 128 rc)); 175 dprintf(("LoadBitmapA returned %08xh\n", rc)); 129 176 130 177 return(rc); … … 137 184 HBITMAP rc; 138 185 139 if( (int)lpszBitmap >> 16!= 0) {//convert string name identifier to numeric id186 if(HIWORD(lpszBitmap) != 0) {//convert string name identifier to numeric id 140 187 astring = UnicodeToAsciiString((LPWSTR)lpszBitmap); 141 188 dprintf(("lpszBitmap %s\n", astring)); … … 153 200 } 154 201 //****************************************************************************** 155 //******************************************************************************156 HCURSOR WIN32API LoadCursorW(HINSTANCE hinst, LPCWSTR lpszCursor)157 {158 char *astring = NULL;159 HCURSOR rc;160 161 if((int)lpszCursor >> 16 != 0) {//convert string name identifier to numeric id162 astring = UnicodeToAsciiString((LPWSTR)lpszCursor);163 dprintf(("lpszCursor %s\n", astring));164 lpszCursor = (LPWSTR)ConvertNameId(hinst, (char *)astring);165 }166 else dprintf(("lpszCursor %d\n", (int)lpszCursor));167 168 rc = O32_LoadCursor(hinst, (char *)lpszCursor);169 if(astring)170 FreeAsciiString(astring);171 172 dprintf(("LoadCursorW returned %d\n", rc));173 return(rc);174 }175 //******************************************************************************176 202 //TODO: Far from complete, but works for loading resources from exe 177 203 //fuLoad flag ignored … … 182 208 HANDLE hRet = 0; 183 209 184 dprintf((" OS2LoadImageA NOT COMPLETE (%d,%d)\n", cxDesired, cyDesired));210 dprintf(("LoadImageA NOT COMPLETE (%d,%d)\n", cxDesired, cyDesired)); 185 211 186 212 switch(uType) { … … 194 220 hRet = (HANDLE)LoadIconA(hinst, lpszName); 195 221 break; 222 default: 223 dprintf(("LoadImageA: unsupported type %d!!", uType)); 224 return 0; 196 225 } 197 dprintf((" OS2LoadImageA returned %d\n", (int)hRet));226 dprintf(("LoadImageA returned %d\n", (int)hRet)); 198 227 199 228 return(hRet); … … 206 235 HANDLE hRet = 0; 207 236 208 dprintf((" OS2LoadImageW NOT COMPLETE (%d,%d)\n", cxDesired, cyDesired));237 dprintf(("LoadImageW NOT COMPLETE (%d,%d)\n", cxDesired, cyDesired)); 209 238 210 239 switch(uType) { … … 218 247 hRet = (HANDLE)LoadIconW(hinst, lpszName); 219 248 break; 249 default: 250 dprintf(("LoadImageW: unsupported type %d!!", uType)); 251 return 0; 220 252 } 221 dprintf((" OS2LoadImageW returned %d\n", (int)hRet));253 dprintf(("LoadImageW returned %d\n", (int)hRet)); 222 254 223 255 return(hRet);
Note:
See TracChangeset
for help on using the changeset viewer.