需要加载resource里的图片,得到它的路径path,填到下面的函数中,ID为IDB_BITMAP1或IDB_PNG1都行,不要CBitmap等MFC的函数,问一下怎么样解决呢?急啊
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, path, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE | LR_DEFAULTCOLOR);
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, path, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE | LR_DEFAULTCOLOR);
解决方案
5
就是你现在使用的这个函数
35
X:\MSDN98_1>grep -xs MAKEINTRESOURCE.*BITMAP *.c *.cpp SemWare Grep v2.0 for Win32 [Jun 12 2003]
Copyright 1996-2003 SemWare Corp. All rights reserved worldwide.
File: X:\MSDN98_1\SAMPLES\MSDN\TECHART\167\HIERDRAW.C
hRes = FindResource(hInstance, MAKEINTRESOURCE(nBitmap), RT_BITMAP);
File: X:\MSDN98_1\SAMPLES\MSDN\TECHART\1762\W32PEN.C
hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));
hPatBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP4));
File: X:\MSDN98_1\SAMPLES\MSDN\TECHART\2103\W32PEN.C
hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP1));
hPatBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP4));
File: X:\MSDN98_1\SAMPLES\VC98\SDK\DBMSG\MAPI\ROUTE.CLI\BITMAP.C
hresLoad = FindResource(hInst, MAKEINTRESOURCE(IDB_ENVELOPE), RT_BITMAP);
File: X:\MSDN98_1\SAMPLES\VC98\SDK\DBMSG\MAPI\SIMPLE.CLI\BITMAP.C
hresLoad = FindResource(hInst, MAKEINTRESOURCE(IDB_ENVELOPE), RT_BITMAP);
File: X:\MSDN98_1\SAMPLES\VC98\SDK\SDKTOOLS\WINNT\DLGEDIT\DLGEDIT.C
hresLoad = FindResource(ghInst, MAKEINTRESOURCE(idbm), RT_BITMAP);
File: X:\MSDN98_1\SAMPLES\VC98\SDK\WINBASE\IO\SERIAL\TTY.C
MAKEINTRESOURCE( TTYBITMAP ) ) ;
File: X:\MSDN98_1\SAMPLES\VC98\MFC\OLE\WORDPAD\RULER.CPP
AfxFindResourceHandle(MAKEINTRESOURCE(nBitmapID+1), RT_BITMAP),
File: X:\MSDN98_1\SAMPLES\VC98\SDK\GRAPHICS\DIRECTX\DPSLOTS\CLIENT.CPP
hWheelBitmap = LoadBitmap(ghInstance, MAKEINTRESOURCE(IDB_SLOTSBITMAP));
File: X:\MSDN98_1\SAMPLES\VC98\SDK\GRAPHICS\DIRECTX\MOSQUITO\MOSQUITO.CPP
hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(lpstrResID), IMAGE_BITMAP, ddsd.dwWidth, ddsd.dwHeight, LR_CREATEDIBSECTION);
X:\MSDN98_1>