Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
%Unicode = 1
%UseWebBrowser = 1 ' // Use the WebBrowser control
#Include Once "CWindow.inc" ' // CWindow class
%IDC_WebBrowser = 1001
%IDC_PrintPreview = 1002
%IDC_Print = 1003
Global hDlg, hBrowser As Dword
Function PBMain
Local pWindow As IWindow
Dialog New Pixels, 0, "WebBrowser",0, 40, 600, 400, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Print, "Print", 10,10,100,25
Control Add Button, hDlg, %IDC_PrintPreview, "Print Preview", 130,10,100,25
pWindow = Class "CWindow"
hBrowser = pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, "http://www.garybeene.com", Nothing, 0, 40, 600,400)
Dialog Show Modal hDlg, Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local pIWebBrowser2 As IWebBrowser2
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Print
pIWebBrowser2 = OC_GetDispatch(hBrowser)
pIWebBrowser2.ExecWB %OLECMDID_PRINT, %OLECMDEXECOPT_PROMPTUSER
Case %IDC_PrintPreview
pIWebBrowser2 = OC_GetDispatch(hBrowser)
pIWebBrowser2.ExecWB %OLECMDID_PRINTPREVIEW, %OLECMDEXECOPT_PROMPTUSER
End Select
End Select
End Function
'gbs_01330
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm