Changeset 3625 for trunk/src/user32/loadres.cpp
- Timestamp:
- May 28, 2000, 6:45:14 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/loadres.cpp
r3482 r3625 1 /* $Id: loadres.cpp,v 1.2 8 2000-05-02 20:50:48sandervl Exp $ */1 /* $Id: loadres.cpp,v 1.29 2000-05-28 16:43:45 sandervl Exp $ */ 2 2 3 3 /* … … 20 20 #include <os2win.h> 21 21 #include <user32.h> 22 #include <winres.h>23 22 #include <heapstring.h> 24 23 #include <oslibres.h> … … 27 26 #include "initterm.h" 28 27 #include <win\cursoricon.h> 28 #include <winres.h> 29 29 30 30 #define DBG_LOCALLOG DBG_loadres … … 60 60 int WIN32API LoadStringW(HINSTANCE hinst, UINT wID, LPWSTR lpBuffer, int cchBuffer) 61 61 { 62 Win32Resource *winres;63 62 WCHAR *p; 64 63 int string_num; 65 64 int i = 0; 65 HRSRC hRes; 66 66 67 67 /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out 68 68 * 20 - 31. */ 69 winres = (Win32Resource *)FindResourceW(hinst, (LPWSTR)(((wID>>4)&0xffff)+1), RT_STRINGW);70 if( winres == NULL) {69 hRes = FindResourceW(hinst, (LPWSTR)(((wID>>4)&0xffff)+1), RT_STRINGW); 70 if(hRes == NULL) { 71 71 dprintf(("LoadStringW NOT FOUND from %X, id %d buffersize %d\n", hinst, wID, cchBuffer)); 72 72 *lpBuffer = 0; … … 74 74 } 75 75 76 p = (LPWSTR) winres->lockResource();76 p = (LPWSTR)LockResource(LoadResource(hinst, hRes)); 77 77 if(p) { 78 78 string_num = wID & 0x000f; … … 93 93 } 94 94 } 95 delete winres;96 95 97 96 #ifdef DEBUG_ENABLELOG_LEVEL2 … … 111 110 DWORD cyDesired, DWORD fuLoad) 112 111 { 113 Win32Resource *winres;114 112 HICON hIcon; 115 113 HANDLE hMapping = 0; 116 114 char *ptr = NULL; 115 HRSRC hRes; 116 LPSTR restype = RT_ICONA; 117 117 118 118 if(fuLoad & LR_LOADFROMFILE) … … 128 128 if(!hinst) 129 129 { 130 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_ICONA); 131 if(!winres) 132 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszIcon,RT_GROUP_ICONA); 133 if(winres) 130 hRes = FindResourceA(hInstanceUser32,lpszIcon,RT_ICONA); 131 if(!hRes) { 132 hRes = FindResourceA(hInstanceUser32,lpszIcon,RT_GROUP_ICONA); 133 restype = RT_GROUP_ICONA; 134 } 135 if(hRes) 134 136 { 135 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 136 delete winres; 137 hIcon = OSLibWinCreateIcon(ConvertResourceToOS2(hInstanceUser32, restype, hRes)); 137 138 } 138 else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));139 else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON)); 139 140 } 140 141 else 141 142 { //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;143 hRes = FindResourceA(hinst,lpszIcon,RT_ICONA); 144 if(!hRes) { 145 hRes = FindResourceA(hinst,lpszIcon,RT_GROUP_ICONA); 146 restype = RT_GROUP_ICONA; 147 } 148 if(hRes) { 149 hIcon = OSLibWinCreateIcon(ConvertResourceToOS2(hinst, restype, hRes)); 149 150 } 150 151 else hIcon = 0; … … 160 161 DWORD cyDesired, DWORD fuLoad) 161 162 { 162 Win32Resource *winres;163 163 HICON hIcon; 164 164 HANDLE hMapping = 0; 165 165 char *ptr = NULL; 166 HRSRC hRes; 167 LPSTR restype = RT_ICONA; 166 168 167 169 if(fuLoad & LR_LOADFROMFILE) … … 177 179 if (!hinst) 178 180 { 179 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_ICONW); 180 if(!winres) 181 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszIcon,RT_GROUP_ICONW); 182 if(winres) 181 hRes = FindResourceW(hInstanceUser32,lpszIcon,RT_ICONW); 182 if(!hRes) { 183 hRes = FindResourceW(hInstanceUser32,lpszIcon,RT_GROUP_ICONW); 184 restype = RT_GROUP_ICONA; 185 } 186 if(hRes) 183 187 { 184 hIcon = OSLibWinCreateIcon(winres->lockOS2Resource()); 185 delete winres; 188 hIcon = OSLibWinCreateIcon(ConvertResourceToOS2(hInstanceUser32, restype, hRes)); 186 189 } 187 190 else hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON)); 188 191 } 189 192 else 190 193 {//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;194 hRes = FindResourceW(hinst,lpszIcon,RT_ICONW); 195 if(!hRes) { 196 hRes = FindResourceW(hinst,lpszIcon,RT_GROUP_ICONW); 197 restype = RT_GROUP_ICONA; 198 } 199 if(hRes) { 200 hIcon = OSLibWinCreateIcon(ConvertResourceToOS2(hinst, restype, hRes)); 198 201 } 199 202 else hIcon = 0; 200 203 } 201 204 } … … 221 224 DWORD cyDesired, DWORD fuLoad) 222 225 { 223 Win32Resource *winres;224 226 HCURSOR hCursor; 225 227 HANDLE hMapping = 0; 226 228 char *ptr = NULL; 229 HRSRC hRes; 230 LPSTR restype = RT_CURSORA; 227 231 228 232 if(fuLoad & LR_LOADFROMFILE) … … 236 240 else 237 241 { 238 if 242 if(!hinst) 239 243 { 240 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_CURSORA); 241 if(!winres) 242 winres = (Win32Resource*)FindResourceA(hInstanceUser32,lpszCursor,RT_GROUP_CURSORA); 243 if(winres) 244 hRes = FindResourceA(hInstanceUser32,lpszCursor,RT_CURSORA); 245 if(!hRes) { 246 hRes = FindResourceA(hInstanceUser32,lpszCursor,RT_GROUP_CURSORA); 247 restype = RT_GROUP_CURSORA; 248 } 249 if(hRes) 244 250 { 245 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 246 delete winres; 251 hCursor = OSLibWinCreatePointer(ConvertResourceToOS2(hInstanceUser32, restype, hRes)); 247 252 } 248 253 else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR)); 249 }250 else251 {//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;254 } 255 else 256 { //not a system icon 257 hRes = FindResourceA(hinst,lpszCursor,RT_CURSORA); 258 if(!hRes) { 259 hRes = FindResourceA(hinst,lpszCursor,RT_GROUP_CURSORA); 260 restype = RT_GROUP_CURSORA; 261 } 262 if(hRes) { 263 hCursor = OSLibWinCreatePointer(ConvertResourceToOS2(hinst, restype, hRes)); 259 264 } 260 265 else hCursor = 0; 261 266 } 262 267 } 263 268 if(HIWORD(lpszCursor)) { … … 273 278 DWORD cyDesired, DWORD fuLoad) 274 279 { 275 Win32Resource *winres;276 280 HCURSOR hCursor; 277 281 HANDLE hMapping = 0; 278 282 char *ptr = NULL; 283 HRSRC hRes; 284 LPSTR restype = RT_CURSORA; 279 285 280 286 if(fuLoad & LR_LOADFROMFILE) … … 290 296 if(!hinst) 291 297 { 292 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_CURSORW); 293 if(!winres) 294 winres = (Win32Resource*)FindResourceW(hInstanceUser32,lpszCursor,RT_GROUP_CURSORW); 295 if(winres) 298 hRes = FindResourceW(hInstanceUser32,lpszCursor,RT_CURSORW); 299 if(!hRes) { 300 hRes = FindResourceW(hInstanceUser32,lpszCursor,RT_GROUP_CURSORW); 301 restype = RT_GROUP_CURSORA; 302 } 303 if(hRes) 296 304 { 297 hCursor = OSLibWinCreatePointer(winres->lockOS2Resource()); 298 delete winres; 305 hCursor = OSLibWinCreatePointer(ConvertResourceToOS2(hInstanceUser32, restype, hRes)); 299 306 } 300 307 else hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor,GetSystemMetrics(SM_CXCURSOR),GetSystemMetrics(SM_CYCURSOR)); 301 302 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;308 } 309 else 310 { //not a system icon 311 hRes = FindResourceW(hinst,lpszCursor,RT_CURSORW); 312 if(!hRes) { 313 hRes = FindResourceW(hinst,lpszCursor,RT_GROUP_CURSORW); 314 restype = RT_GROUP_CURSORA; 315 } 316 if(hRes) { 317 hCursor = OSLibWinCreatePointer(ConvertResourceToOS2(hinst, restype, hRes)); 311 318 } 312 319 else hCursor = 0; 313 320 } 314 321 } 315 322 dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor)); … … 498 505 hBitmap = LoadBitmapA(hinst, lpszBitmap, 0, 0, 0); 499 506 500 dprintf(("LoadBitmapA returned %08xh\n", hBitmap)); 507 if(HIWORD(lpszBitmap)) { 508 dprintf(("LoadBitmapA %x %s returned %08xh\n", hinst, lpszBitmap, hBitmap)); 509 } 510 else dprintf(("LoadBitmapA %x %x returned %08xh\n", hinst, lpszBitmap, hBitmap)); 501 511 502 512 return(hBitmap); … … 517 527 FreeAsciiString((LPSTR)lpszBitmap); 518 528 519 dprintf(("LoadBitmapW returned %08xh\n", hBitmap)); 529 if(HIWORD(lpszBitmap)) { 530 dprintf(("LoadBitmapW %x %s returned %08xh\n", hinst, lpszBitmap, hBitmap)); 531 } 532 else dprintf(("LoadBitmapW %x %x returned %08xh\n", hinst, lpszBitmap, hBitmap)); 520 533 521 534 return(hBitmap);
Note:
See TracChangeset
for help on using the changeset viewer.