HI!
The idea is to print a file using VB6 and API!
I want to print Tiff, Word, Excell and Acrobat files for example!
Can anybody help me?
Thanks,
Printable View
HI!
The idea is to print a file using VB6 and API!
I want to print Tiff, Word, Excell and Acrobat files for example!
Can anybody help me?
Thanks,
To print a document with it's associated program, you can use the ShellExecute API.
eg.
Code: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 PrintIt(ByVal sPath As String)
Dim retVal As Long
retVal = ShellExecute(hwnd, "print", sPath, vbNullString, vbNullString, 0&)
If retVal <= 32 Then
MsgBox "Error Printing" & vbCrLf & "DLL Error : " & Err.LastDllError
End If
End Sub
Private Sub Command1_Click()
Call PrintIt("g:\test1.txt")
End Sub
Maybe you can use BitBlt to draw on the printers DC.