How to load a bitmap to the desktop window? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to load a bitmap to the desktop window?

I am trying to blit a bitmap from the resources and show it on the desktop window, but it does not show anything, why?????

This is my code:

HWND desktop_wnd;

HDC desktop_hdc;
HDC hdc_bitmap;
HBITMAP hbitmap;

hbitmap=CreateCompatibleBitmap(hdc,100,100);

hbitmap=LoadBitmap(g_hInst,MAKEINTRESOURCE(IDB_BITMAP5)); //Load a bitmap

hdc_bitmap=CreateCompatibleDC(desktop_hdc);


SelectObject(hdc_bitmap,hbitmap);

desktop_wnd=GetDesktopWindow();
desktop_hdc=GetWindowDC(desktop_wnd);

BitBlt(desktop_hdc,0,0,100,100,hdc_bitmap,0,0,SRCCOPY);


I cant see anything wrong with it, can you ?

I hope someone can help, thanks Dani
Sign In or Register to comment.