我对 Visual Studio C++ 很陌生。我正在尝试从我的系统中加载具有特定路径的 bmp 文件并将其显示在 mfc 的图片控件上,但我无法这样做。任何人都可以在这里指导我。我尝试了以下但我收到一个错误..
代码:
filePath = "images/0000.4d.bmp";
ASSERT(filePath);
HBITMAP hBitmap= NULL;
hBitmap = (HBITMAP) LoadImage (
0,
filePath,
IMAGE_BITMAP,
0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
IDB_PICTURE2.LoadBitmapW(MAKEINTRESOURCE(hBitmap));
m_picture.SetBitmap(IDB_PICTURE2);
当我尝试加载 bmp 文件时发生错误。谢谢你。
错误:
Detected memory leaks!
Dumping objects ->
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {525} normal block at 0x0034B848, 54 bytes long.
Data: < x > 84 CF B1 78 12 00 00 00 12 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp(4500) : {518} client block at 0x0034B708, subtype c0, 56 bytes long.
a CObject object at $0034B708, 56 bytes long
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {511} normal block at 0x0034B1C8, 42 bytes long.
Data: < x > 84 CF B1 78 0C 00 00 00 0C 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occmgr.cpp(195) : {510} normal block at 0x0034B170, 24 bytes long.
Data: < > E8 03 00 00 00 00 00 00 E9 03 00 00 00 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occmgr.cpp(181) : {509} normal block at 0x0034B120, 16 bytes long.
Data: < > FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00
c:\documents and settings\raja hadi ashraf\my documents\visual studio 2010\projects\mirrorimage\mirrorimage\mirrorimage.cpp(59) : {505} client block at 0x0034AFB0, subtype c0, 12 bytes long.
a CObject object at $0034AFB0, 12 bytes long
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(156) : {494} normal block at 0x0034CDF8, 22 bytes long.
Data: < x > 84 CF B1 78 02 00 00 00 02 00 00 00 01 00 00 00
Object dump complete.
The program '[0x62C] mirrorImage.exe: Native' has exited with code 3 (0x3).