News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Is it possible to render a window to a bitmap without showing the window?

Started by xanatose, March 16, 2022, 06:38:43 AM

Previous topic - Next topic

xanatose

I basically need to render win32 controls on an OpenGL application. Letting windows handle the UI. (Specially the text input in other languages). While allowing transformation of the windows rectangles in 3d.


Greenhorn

Hi xanatose,

I have no idea what you try to do but anyways ...


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;    CreateBitmapFromCtrl
;
CreateBitmapFromCtrl proc hwndCtrl:HWND

LOCAL hdc: HDC
LOCAL hbm: HBITMAP
LOCAL hObjOld: HGDIOBJ
LOCAL rc: RECT

invoke GetClientRect, hwndCtrl, addr rc

invoke CreateCompatibleDC, 0

.if (rax)
mov  hdc, rax
.else
jmp  @F
.endif

invoke CreateCompatibleBitmap, hdc, rc.right, rc.bottom

.if (rax)
mov  hbm, rax
.else
invoke DeleteDC, hdc
jmp  @F
.endif

invoke SelectObject, hdc, hbm

mov  hObjOld, rax

invoke SendMessage, hwndCtrl, WM_PRINTCLIENT, hdc, PRF_CLIENT

invoke SelectObject, hdc, hObjOld
invoke DeleteDC, hdc

mov  rax, hbm
@@:
ret
CreateBitmapFromCtrl endp


Kind Regards
Greenhorn
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.