Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically print a Document

Status
Not open for further replies.

HPfeffer

Programmer
Jul 1, 2002
3
DE
Problem:
I wan't to print a pdf-Document from an VB Application via the Shell-Command (Shell "acrord32.exe /p doc.pdf"). This works fine, but if the Reader has the print-dialog open before I start the printing nothing happens (no error, no print). What can I do? Is it possible to check, in which state the Reader is?
PS: If I use the DLL-functions
i = CreateProcessA( 0&, RunProg, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, StartInf, proc )
i = WaitForSingleObject( proc.hProcess, INFINITE )
i = CloseHandle( proc.hProcess )

VB never ends (even if I close the Reader)

Thanks for helping!
 
HPfeffer this should do the job. It will open an Acrobat file, it will print it but I am having problems closing it, so if you find a way let me know.



Private Declare Function ShellExecute Lib "shell32" _
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 Const SW_HIDE = 0
Private Const SW_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Const SW_SHOWDEFAULT As Long = 10
Private Const SE_ERR_NOASSOC As Long = 31

'-------------------------
'Command Button
Dim strPath3 As String
strPath3 = ("File name")
Call ShellExecute(0&, "print", strPath3, 0&, 0&, SW_HIDE)
End If
End Sub

Cheers

[afro]ZeroAnarchy
Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top