Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3021

Problem with LoadBitmap using MAKEINTRESOURCE

$
0
0
Im using Visual Studios 2012 using c++ I have been trying to load a bitmap from my resources
Like this

Code:

HRESULT DemoApp::CreateDIBFromResource(HWND hWnd, HINSTANCE Instance, LPCWSTR ImageID)
{
        HRESULT hr = S_OK;

        HBITMAP bitmap = (HBITMAP)LoadBitmap(GetModuleHandle(0),MAKEINTRESOURCE(ImageID));

       
   

    return hr;

}


and calling the function like this

Code:

if(SUCCEEDED(CreateDIBFromResource(hWnd,NULL, MAKEINTRESOURCE(IDB_BACKGROUND))))
{
  InvalidateRect(hWnd, NULL, TRUE);
}

It wasn't loading anything so I put a breakpoint at
Code:

return hr;
when I hover the cursor over ImageID it says
ImageID = 0x00000065 <Error reading characters of string.>

I cant figure out the problem I have Unicode enabled I don't know if that has anything to do with it.

Viewing all articles
Browse latest Browse all 3021

Trending Articles