Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32api.inc"
%IDC_ListBox = 500
%IDC_Button = 501
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "",,,250,250, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button, "Print ListBox", 10,10,220,20
Control Add ListBox, hDlg, %IDC_ListBox, , 10,40,220,200
ListBox Add hDlg, %IDC_ListBox, "One" : ListBox Add hDlg, %IDC_ListBox, "Two"
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = %IDC_Button Then PrintListBox
End Function
Sub PrintListBox
Local x,y,w,h,x1,y1 As Long, hDeskTopDC,hPrinterDC As Dword
Dialog Get Loc hDlg To x,y
Control Get Loc hDlg, %IDC_ListBox To x1,y1
Control Get Size hDlg, %IDC_ListBox To w,h
XPrint Attach Default
XPrint Get DC To hPrinterDC
hDeskTopDC = GetDC(%Null)
StretchBlt hPrinterDC, 100,100,w*10,h*10, hDesktopDC, x+x1,y+y1,w,h, %SRCCopy 'copy desktop image to
ReleaseDC(%Null,hDeskTopDC)
XPrint Close
End Sub
'gbs_01199
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm