Nope. vb6
This code is in an ActiveX dll. The process doesn't have an UI but this
dll requires a form and the control just to print the HTML.
dan
> This code is in an ActiveX dll. The process doesn't have an UI but this
> dll requires a form and the control just to print the HTML.
>
> dan
You might try something like this.... works fine here. The "guts" are behind
Command1... sample needs a textbox and a command button..
'===========
Option Explicit
Private 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
Private Sub Form_Load()
'Place the full path to your file here....
Text1.Text = "C:\Temp\Test.htm"
End Sub
Private Sub Command1_Click()
Const SW_SHOWDEFAULT As Long = 10
Dim sFullPathToFile As String
sFullPathToFile = Text1.Text
Call ShellExecute(0, "Print", sFullPathToFile _
, 0&, 0&, SW_SHOWDEFAULT)
End Sub
'===========

Signature
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Sign up now to help keep VB support alive - http://classicvb.org/petition
Please keep all discussions in the groups..
Dan Holmes - 15 Mar 2005 04:27 GMT
>>This code is in an ActiveX dll. The process doesn't have an UI but this
>>dll requires a form and the control just to print the HTML.
[quoted text clipped - 5 lines]
> '===========
> Option Explicit
...
> Private Sub Command1_Click()
> Const SW_SHOWDEFAULT As Long = 10
[quoted text clipped - 6 lines]
> End Sub
> '===========
is there any way to do this without the print dialog? I need it to go
directly to the printer without user interaction.
dan
Phil - 16 Mar 2005 22:06 GMT
Hi there,
I ran thru the same problem, asked the question in this very same
newsgroup earlier and it seems that there is no way to bypass the
printer dialog...
At some point in time I was thinking of using Sendkeys to click this
bloody OK button, but couldn't make it to work!
Weird....We are so many out there willing to achieve this...
Phil
> is there any way to do this without the print dialog? I need it to go
> directly to the printer without user interaction.
>
> dan
Bob O`Bob - 16 Mar 2005 23:28 GMT
> Hi there,
>
[quoted text clipped - 13 lines]
>>
>> dan
There are ways to interact with the dialog other than SendKeys.
For example, here's some snippets of code using a method which
I consider hideously ugly ... but it works. I'm pretty sure
this is for Outlook Express:
PostMessage(lExpressWnd, WM_COMMAND, 40116, 0) 'open print dialog
lPrnDlg = FindWindow("#32770", "Print")
FindWindowEx(lPrnDlg, 0, "Button", "&Print") 'Find button on dialog
SendMessage(lOkWnd, BM_CLICKED, 0&, 0&) 'click button
There's other code interspersed with these, but it may help you get the concept.
Bob
Steven Moschidis - 17 Mar 2005 10:54 GMT
I am sure there is a cleaner way of doing this as MS does it on their
MCP website... if you want to print your qualifications it goes straight
to the printer without displaying a dialog.
I bet this is also one of the undocumented features that we are not
deemed worthy of knowing.
Steven
>> Hi there,
>>
[quoted text clipped - 28 lines]
>
> Bob