Try this code: finds the application by the associate. For example here,
.htm, it get the IE. If you change to .PDF, I think you can get acrobat
reader.
Public Declare Function FindExecutable Lib "shell32.dll" Alias
"FindExecutableA" _
(ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As
String) As Long
Public 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
Dim Dummy As String
Dim BrowserExec As String * 255
Dim retval As Long
Const SW_SHOWNORMAL = 1
Dim sFileName As String
sFileName = App.Path & "\aa.htm"
retval = FindExecutable(sFileName, Dummy, BrowserExec)
BrowserExec = Trim(BrowserExec)
' If an application is found, launch it!
If retval <= 32 Or IsEmpty(BrowserExec) Then ' Error
' MsgBox "Could not find a browser"
Else
retval = ShellExecute(Me.hwnd, "open", BrowserExec,
"http://www.abc.com", Dummy, SW_SHOWNORMAL)
If retval <= 32 Then ' Error
' MsgBox "Web Page not Opened"
End If
End If
-----Original Message-----
From: Kevin Crider [mailto:criderkevin@a...]
Sent: Thursday, October 24, 2002 7:32 AM
To: professional vb
Subject: [pro_vb] GetPath to exe
Hey All:
Whats the best way to determine the path of an installed app? i.e., I need
to determine/verify the path 2 apps (exe's), Acrobat Reader and Excel...
are they installed where I think they are...? I thought maybe the GetPath
API would do the trick but I dont know how to use it :(
And I've heard bad things about searching the registry for this info...sup?
Something else that would be useful, but not necessarily in the same bit
of code as the above, would be a way to check the version too..is Acrobat
Reader v.4 or v.5??? Is excel v.97, v.2000, or vXP...?
tia
Kevin
---
Visual C# - A Guide for VB6 Developers
This book will make it easy to transfer your skills
from Visual Basic 6 to C#, the language of choice
of the .NET Framework.
http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059