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.

Howdy, Stranger!

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

Categories