Solved

Printing from Internet control

Posted on 2000-05-03
15
151 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

828 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