Solved

50 Easy points!  Is it possible to print with WebBrowser1.Visible set to False?

Posted on 2004-09-07
6
294 Views
Last Modified: 2013-12-25
Here's my code:

Private Sub Form_Load()
     WebBrowser1.Navigate "www.cnn.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If WebBrowser1.ReadyState = READYSTATE_COMPLETE Then
      WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
    End If
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
    Me.Caption = Text
End Sub

Is it possible for this code to work if the WebBrowser1.Visible is set to False?
0
Comment
Question by:shaolinfunk
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:coopzz
Comment Utility
yer should do

I do something similar things in vb.net and vb6 eg: a notification service that prints web pages  to printers in a windows service

actually if anyone knows of an object that can print web pages with specified printer without using this internet controls would be a great find
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 25 total points
Comment Utility
Did you test it ? Perhaps you need another event. Can you give this a try
Private Sub Form_Load()
     WebBrowser1.Navigate "www.cnn.com"
End Sub

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    WebBrowser1.Visible = True
    WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
    WebBrowser1.Visible = False
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
    Me.Caption = Text
End Sub
0
 
LVL 11

Expert Comment

by:coopzz
Comment Utility
try that event it worked perfectly

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    WebBrowser1.Visible = True
    WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, Null, Null
    WebBrowser1.Visible = False
End Sub
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 1

Author Comment

by:shaolinfunk
Comment Utility
actually.  what i meant by my question was having it set to false ALL the time.  is it possible to do that and still print?  that way, the user doesn't know that there was a webbrowser control there.
0
 
LVL 11

Assisted Solution

by:coopzz
coopzz earned 25 total points
Comment Utility
well why don't you just use the other solution you got.

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Controls/Q_21108534.html

that should work a hell of a lot better.

if you don't want a user to see the form, do a microsoft hack and place the form in a really obscure spot without putting it in the system tray.
top = -1000
left = -1000
showintaskbar = false

cause it looks like with the control it needs to be visible in vb to print Sorry.
but Like I said the other way I've used and works. try starting from scratch again.


0
 
LVL 1

Author Comment

by:shaolinfunk
Comment Utility
"cause it looks like with the control it needs to be visible in vb to print Sorry."
that's what i wanted to make sure of.  thanks.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now