Hi, does anyone know a simple way to display a bitmap permanently on an irregular window? I've read comrade's tutorial on doing irregular shaped windows and he seems to have done it using some bitmap algorithm or something. I'm just wondering if there's another way to do it with just using good ol' APIs? I've tried using bitblt, it displayed the bitmap, but the moment the window goes beneath another window, the image clears out.

I'd appreciate any help :)
Posted on 2001-10-08 04:01:57 by clip
Keep the bitmap in memory along with a memory DC for it. Then inside the WM_PAINT message BitBLt to the screen.

Winodws send WM_PAINT when a window needs redrawing.
Posted on 2001-10-08 04:19:47 by Eóin
Yeah that's what I did, it worked it showed the bitmap, but the moment you put a window on top of it, the picture gets erased.
Posted on 2001-10-09 10:09:54 by clip
Perhaps your deleting the bitmap once its displayed. Or maybe your storing the handles in local variables. Whatever the reason it probably a simple error as this method will work.

All i used was the following code

hBmp dd ?
bmpDc dd ?

;This runs in the WM_CREATE message
invoke LoadBitmap,gIst,1
mov hBmp,eax
invoke CreateCompatibleDC,0
mov bmpDc,eax
invoke SelectObject,eax,hBmp

; This runs in WM_PAINT
invoke BeginPaint,hWnd,addr ps
invoke BitBlt,ps.hdc,0,0,200,167,bmpDc,0,0,SRCCOPY
invoke EndPaint,hWnd,addr ps

I've included the code and exe so you can study it. :)
Posted on 2001-10-09 14:53:05 by Eóin
I didn't know when putting bitmaps to irregularly shaped windows CreateCompatibleDC won't work properly when placed inside the WM_PAINT event even if it was the first thing to do.

anyway, its works fine now the bitmap sticks to the irregularly shaped window, thanks!
Posted on 2001-10-10 05:20:58 by clip