Solved

Printing from Internet control

Posted on 2000-05-03
15
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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!

 
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

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!

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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