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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch PDF File From VB 1

Status
Not open for further replies.

SpiderBear6

Programmer
Sep 17, 2003
422
AU
Hi all,

Does anyone know how to launch a pdf file from a VB app? And then I guess my next question is ... is there a merge module to install acrobat reader onto the user's machine?

Thanks.

--------------------------------------
"We are star-stuff. We are the universe made manifest trying to figure itself out."
-- Delenn in Babylon 5 - "A Distant Star"
 
To open a PDF file:

Code:
'// declare:
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

'// usage:
ShellExecute Me.hWnd, "Open", "yourfile.pdf", 0&, 0&, 1&
'// the last parameter is the window style.

As for the merge module, I am not sure. However, you could point your users at an Adobe website during the installation process -- the Acrobat Reader is free, but I'm not sure if it's legal to distribute it with your software without permission from Adobe.
 
Slight variation in how I do it, not sure of the advantage/disadvantage.

Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long

Dim Scr_hDC As Long
Const SW_SHOWNORMAL = 1
Scr_hDC = GetDesktopWindow()
ShellExecute Scr_hDC, "Open", "MyFile.pdf", "", "C:\", SW_SHOWNORMAL

 
My end users don't have access to the internet. I am trying to include the reader installation into my installation. Haven't succeeded yet.

--------------------------------------
"We are star-stuff. We are the universe made manifest trying to figure itself out."
-- Delenn in Babylon 5 - "A Distant Star"
 
You could have your installer check for the presence of Acrobat and launch the (bundled) Acrobat setup EXE if it's not found.
 
That's what I am trying to get InstallShield to do, but I can only figure out how to launch the .msi file, which isn't enough before it needs the other support files to run.

--------------------------------------
"We are star-stuff. We are the universe made manifest trying to figure itself out."
-- Delenn in Babylon 5 - "A Distant Star"
 

With the standard PDW you can accomplish what you want but it is not the easiest route to go and before you start playing with any of the setup project files I would strongly suggest that you copy it first and then only play with the copy.

You will find some suggestion upon this subject with a search of copy setup in your forums using all words, or perhaps a new thread upon the subject.

Good Luck

 
Thanks for your help guys.

--------------------------------------
"We are star-stuff. We are the universe made manifest trying to figure itself out."
-- Delenn in Babylon 5 - "A Distant Star"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top