How can I create a graphic display window in a dialog box?

I've tried to use a static image control and STM_SETIMAGE display bitmaps, but I think you can only use bitmap resources with this method. I need a way to display a bitmap I loaded off disk.

I can just BitBlt the image to the dialog box window, but it gets erased whenever something covers it up.
Posted on 2002-03-19 22:08:55 by The Worrier King
so u can subcllas that control, for example STATIC, and put your BitBlt in WM_PAINT message controler.

from imagelib - PAINT.ASM
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

LOCAL hdc:HDC
LOCAL ps:PAINTSTRUCT
LOCAL rect:RECT
LOCAL tempDC:DWORD
LOCAL htbmp
.IF uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.ELSEIF uMsg==WM_PAINT
invoke BeginPaint,hWnd, ADDR ps
mov hdc,eax
invoke GetClientRect,hWnd, ADDR rect
invoke DrawText, hdc,ADDR OurText,-1, ADDR rect, DT_SINGLELINE or DT_CENTER or DT_VCENTER
invoke CreateCompatibleDC, hdc
mov tempDC, eax
invoke SelectObject, tempDC, hBmp
mov htbmp, eax
invoke BitBlt, hdc, 0,0,rect.right,rect.bottom, tempDC, 0, 0, SRCCOPY
invoke SelectObject, tempDC, htbmp
invoke DeleteDC, tempDC
invoke EndPaint,hWnd, ADDR ps
.ELSEIF uMsg==WM_CREATE
invoke BitmapFromFile, ADDR szFile
; invoke BitmapFromResource, hInstance, 2002
; invoke BitmapFromResource, hInstance, 2001
mov hBmp, eax
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp

Hope this will help :)
Posted on 2002-03-20 02:27:37 by NEMO
You know, that's just crazy enough to work!

Actually, I've tried it already and it looks good. I started with an EDITTEXT control, and overrode the WM_PAINT handler to put my image into the control's client area.

Thanks Nemo. :alright:
Posted on 2002-03-20 17:03:03 by The Worrier King