C++ c++;从资源visual Studio 2012绘图窗口加载图像
我在visual Studio 2012中加载图像时遇到问题:C++ c++;从资源visual Studio 2012绘图窗口加载图像,c++,visual-studio-2012,bitmap,resources,window,C++,Visual Studio 2012,Bitmap,Resources,Window,我在visual Studio 2012中加载图像时遇到问题: case WM_PAINT: hBitmap = (HBITMAP)LoadImage(::hInstance, L"apple.jpg", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); // problem?? PAINTSTRUCT ps; HDC hdc; BITMAP
case WM_PAINT:
hBitmap = (HBITMAP)LoadImage(::hInstance, L"apple.jpg", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); // problem??
PAINTSTRUCT ps;
HDC hdc;
BITMAP bitmap;
HDC hdcMem;
HGDIOBJ oldBitmap;
hdc = BeginPaint(hWnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
oldBitmap = SelectObject(hdcMem, hBitmap);
GetObject(hBitmap, sizeof(bitmap), &bitmap);
BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, oldBitmap);
DeleteDC(hdcMem);
EndPaint(hWnd, &ps);
return 0;
我将图像从桌面拖放到visual Studio 2012中,但该图像未显示在我的窗口中
我认为问题在于L“apple.jpg”,有人不知道我做错了什么吗 问题在于“LoadImage”方法不支持JPG图像。它只支持BMP。那么你做了什么?你刚刚更改了JPEG的文件扩展名吗?