Solved

Printing from Internet control

Posted on 2000-05-03
15
154 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

624 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