|
-
Apr 19th, 2001, 08:23 AM
#1
Thread Starter
Addicted Member
I want to print an Adobe Acrobat PDF file from within a Visual Basic 6 program - I don't need to view it or anything like that, I just want to print it - I know that if you right click the file in Windows Explorer, it gives you the option to print - Can I use an API call to do this exact same thing????? Thanks in Advance!!!!!!!!!
GENE
-
Apr 19th, 2001, 08:46 AM
#2
Frenzied Member
'\\ Declaration
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
Using this api and passing "Print" in the lpOperation parameter causes windows to print out the document using whichever application is associated with that document. The code to use this from a VB form is:
Public Sub PrintDocument(ByVal sDocumentName As String)
Const SW_HIDE = 0
Dim lRet As Long
LRet = ShellExecute(Me.hWnd, "Print", sDocumentName, "","",SW_HIDE)
End Sub
If ShellExecute is successful, the return value (lRet) will be greater than 32.
-
Apr 30th, 2001, 03:11 PM
#3
Junior Member
MerrionComputin,
This is fine but how do we terminate the program we used to print from after we have finished with it. Using the hide operator keeps the app open in its hidden state.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|