Dear everyone,
I found some code which is using the internet web control to display web page in SBO. When i try to print the web page using the following code. The queryStatus always return 0 and the print dailog is not shown. Anyone try that before??
Private Function IsPrinterEnabled(ByRef oWebX As SHDocVw.WebBrowser) As Boolean
Dim response As Short = Fix(oWebX.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_PRINT))
Return IIf((response And Fix(SHDocVw.OLECMDF.OLECMDF_ENABLED)) <> 0, True, False) 'TODO: For performance reasons this should be changed to nested IF statements
End Function 'IsPrinterEnabled
' Printing code
Dim oActX As SAPbouiCOM.ActiveX
Dim oWebX As SHDocVw.WebBrowser
Dim eQuery As SHDocVw.OLECMDF 'return value type for QueryStatusWB
oLayoutForm = m_UI_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
oActX = oLayoutForm.Items.Item(c_sInternetItemUID).Specific
oActX.ClassID = "Shell.Explorer.2"
oWebX = oActX.Object
Dim o As Object
o = ""
' constants useful when printing
Dim Print As SHDocVw.OLECMDID = SHDocVw.OLECMDID.OLECMDID_PRINT
Dim PromptUser As SHDocVw.OLECMDEXECOPT = SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER
If Not IsPrinterEnabled(oWebX) Then
Exit Sub
End If
oWebX.ExecWB(Print, PromptUser, o, o)
Regards,
Kit