Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

Printing from Internet control

I am using a form with Microsoft Internet control SHDocVwCH (SHDOCVW.DLL) on it. It navigates to any page on Intranet or Internet. My users want to print the page the same way we can do it in full blown Internet Explorer. Any idea how I can do it in this control? I am using Visual Basic 5.0.
Thanks a lot!
0
burevestnik
Asked:
burevestnik
  • 8
  • 7
1 Solution
 
burevestnikAuthor Commented:
Thank you very much I will try that!
0
 
burevestnikAuthor Commented:
I just tried this solution, unfortunately, it does not work. Since, I am mot sure what all these API calls should return, I do not know how to debug it. After clicking on a button, code nicely executes, and nothing happens... The only thing I hear is a click from speakers.
I wonder, right mouse click menu has an item called Print, but I was not able to find any way to access it.
Do yopu have any ideas about it?
Thanks a lot!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
AzraSoundCommented:
that should be working...always has for me...if you would like to send me your form, send it to azrasound@aol.com
0
 
burevestnikAuthor Commented:
I probably. I just found out that in debug window, browser.HWND returns Automation error. Might that be some settings on my PC? I use VB 5 and Internet Explorer 4.02.
0
 
AzraSoundCommented:
which reference to the webbrowser control's handle in the code does this error pop up?
0
 
burevestnikAuthor Commented:
I just typed this code in Debug window. It is not part of the code you have recommended.
0
 
AzraSoundCommented:
try starting with a new project and a blank form and follow the code at the link provided EXACTLY as is...if it still doesnt work then we need to start checking some things
0
 
burevestnikAuthor Commented:
OK, I'll do that.
Thanks!
0
 
burevestnikAuthor Commented:
I just tried it. Does not work. I have a feeling that this is some settings on my PC. What should I check for?
0
 
AzraSoundCommented:
i dont see how it could be related to any settings on your PC...this only has to do with the control and the form and the code...do me a favor and add this:

where, in the module, it says SetFocusApi(hwnd), make it this:


MsgBox SetFocusApi(hwnd) and tell me what it says
0
 
burevestnikAuthor Commented:
It says 2332
0
 
AzraSoundCommented:
hmm its returning a valid handle...very strange..try this:


Private Sub Command1_Click()
      Dim eQuery As OLECMDF       'return value type for QueryStatusWB

      On Error Resume Next
      eQuery = WebBrowser1.QueryStatusWB(OLECMDID_PRINT)  'get print command status
      If Err.Number = 0 Then
                If eQuery And OLECMDF_ENABLED Then
                    WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER, "", ""    'Ok to Print?
              Else
                    MsgBox "The Print command is currently disabled."
                End If
      End If
      If Err.Number <> 0 Then MsgBox "Print command Error: " & Err.Description
End Sub

0
 
burevestnikAuthor Commented:
It finally worked just fine. I will have just to catch hitting a Cancel button on the Print dialog box.
Thank you very much!!!
How can I increase number of points you earned answering this question?
0
 
AzraSoundCommented:
its ok...its not that important...if you really feel the need you can post another question with the extra points.  Glad you got it working!  =)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now