Author Topic: Is it possible to render a window to a bitmap without showing the window?  (Read 754 times)

xanatose

  • Member
  • ***
  • Posts: 421
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

  • Member
  • ***
  • Posts: 493
Hi xanatose,

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

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;    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.