Solved

Printing from Internet control

Posted on 2000-05-03
15
150 Views
Last Modified: 2010-05-02
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
Comment
Question by:burevestnik
  • 8
  • 7
15 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
ID: 2774006
0
 

Author Comment

by:burevestnik
ID: 2774019
Thank you very much I will try that!
0
 

Author Comment

by:burevestnik
ID: 2774854
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 28

Expert Comment

by:AzraSound
ID: 2774876
that should be working...always has for me...if you would like to send me your form, send it to azrasound@aol.com
0
 

Author Comment

by:burevestnik
ID: 2774895
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
 
LVL 28

Expert Comment

by:AzraSound
ID: 2774910
which reference to the webbrowser control's handle in the code does this error pop up?
0
 

Author Comment

by:burevestnik
ID: 2774914
I just typed this code in Debug window. It is not part of the code you have recommended.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2774927
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
 

Author Comment

by:burevestnik
ID: 2774937
OK, I'll do that.
Thanks!
0
 

Author Comment

by:burevestnik
ID: 2774954
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
 
LVL 28

Expert Comment

by:AzraSound
ID: 2774984
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
 

Author Comment

by:burevestnik
ID: 2774991
It says 2332
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2775033
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
 

Author Comment

by:burevestnik
ID: 2775071
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
 
LVL 28

Expert Comment

by:AzraSound
ID: 2775136
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question