Date: 02-16-2022
Return to Index
created by gbSnippets
'Capturing a BMP of the active dialog is a great tool for documenting
'an application. The Windows %WM_Print message does the trick.
'Primary Code:
SendMessage hDlg, %WM_Print, hDC, %PRF_Client Or %PRF_NonClient Or %PRF_Children Or %PRF_EraseBkgnd
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg,hDC As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Dialog Capture",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Capture", 10,10,100,20
Control Add Graphic, hDlg, 200,"", 10,40,180,150, %WS_Border
Graphic Attach hDlg, 200
Graphic Get DC To hDC
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = 100 And Cb.CtlMsg = %BN_Clicked Then
' SendMessage hDlg, %WM_Print, hDC, %PRF_Client Or %PRF_NonClient Or %PRF_Children Or %PRF_EraseBkgnd
SendMessage hDlg, %WM_Print, hDC, %PRF_Client Or %PRF_NonClient Or %PRF_Children
Graphic ReDraw
End If
End Function
'gbs_00969
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm