Link to home
Start Free TrialLog in
Avatar of Haho
Haho

asked on

hi@@ Question:How to print web page in VB?

Hi guys! Hope u can help me out here! :) I am using a web browser control in VB5.0
and I want to implement a print button to print the contents of the web browser control....
I saw in the history a example which goes .. WebBrowser1.ExecWB something...
but this control that I am using doesn't support this method/operation.
Maybe it is a different (earlier) version of the webbrowser control?
An example from u experts would be nice .. Thanks !!!

David Chong
ASKER CERTIFIED SOLUTION
Avatar of wford
wford
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Haho
Haho

ASKER

Thanks wford , but I have referred to the history example b4 ( using ExecWB)...
but my comp. has decided to use shdocvw.dll from IE3 , and not IE4 so I won't be able to use ExecWB..
is there any other way ( perhaps through more longer/complicated coding ) that allows me to print the web page instead of using the shdocvw.dll from IE4.
The reason is because most of our customers might not have the latest IE version (v4)
BTW, can we package the IE4 shdocvw.dll together with my application?
Is the IE4 shdocvw.dll fully compatible with IE3 shdocvw.dll??
A short example would be appreciated .. thanks!!



Ah, yes we had exactly the same problem,
our original solution was to use the shellexecute function,
this is OK if you only have one form, and do not mind dialog boxes poping up evernow and again(depends on the browser installed).

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

n = ShellExecute(Me.hwnd, "Print", TempFile, "", "", 5)

where, tempfile is a flat file with an Html extention, you also need to check if there is a print command on the computer, for this you need to look in the registery.

the other solution is the one i found too late and which I think is better, there is an OCX called webster pro, at www.homepagesw.com, it costs about $465, and has a couple of print functions in it, it is about a meg in size and you can ship it with your app.
 good luck
Avatar of Haho

ASKER

Thanks, wford... here are your points.. :)

David Chong