Winapi LoadBitmap() is not loading images from my resources

In my .rc file I have add line:

IMG BITMAP "myIMG.bmp" //add to resources

Prototype in .cpp file:

HBITMAP     Image;

after ShowWindow() I load it in to memory with:


On WM_CREATE: I load it on to the screen and clear it out:

HDC GetDC (hdc);    
HDC newhdc = CreateCompatibleDC(hdc);   

Thanks to @BeneGal question (founded here) I have created a MB that tells if the img is not loaded:

if(Image == NULL) {

When I paste the above code right after ShowWindow() the MB don't appear, when I paste it on WM_CREATE: it appears. Don't know why.

edit: Well actually I forgot to tell that image does not appear on my window and that is the main problem.


Load your bitmap in WM_CREATE use it in WM_PAINT. Keep track of return objects by SelectObject and don't delete object which are still selected in HDC. Do something like that

Need Your Help

Event for marker position change

android android-maps android-maps-v2

I'm using the new Google Maps for Android v2.

C - main() command line parameters

c command-line parameters main

This is a really basic question but I can't find a definitive answer anywhere.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.