|
-
Apr 14th, 2006, 02:10 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Want to find installation location
Hi all,
I've installed Adobe acrobat in my system. my application will launch Acrobat using Shell command.
VB Code:
shell "C:\program files\Adobe\Acrobat\Acrobat.exe"
I created a package of my application and installed on another system. In that system my application refused to open Acrobat. Since the acrobat is installed on different location. i.e., in my system it was installed in "C:\program files\". But In remote system it was installed in "F:\program files". How can I find the location where acrobat is installed through code. So that i can run my applcation on both the systems without any problems.
Or is there any other way to get rid of this problem?
Thanks in advance.
-
Apr 14th, 2006, 03:12 AM
#2
Re: Want to find installation location
You can find the location in the registry at:
HKEY_CLASSES_ROOT\AcroExch.Document\shell\open\command
What do you want to do after acrobat is open?
If you want to open a pdf file, you can open the file with the ShellExecute API.
ShellExecute opens a file with it's associated program, so you don't need to know where that program is located, or which program it is.
There are plenty of examples on this forum about its usage.
-
Apr 14th, 2006, 07:19 AM
#3
Re: Want to find installation location
You can also use this API to locate a file.
VB Code:
Option Explicit
Private Declare Function SearchTreeForFile Lib "imagehlp" _
(ByVal RootPath As String, ByVal InputPathName As String, _
ByVal OutputPathBuffer As String) As Long
Private Const MAX_PATH = 260
Private Sub Command1_Click()
Dim tempStr As String, Ret As Long
'create a buffer string
tempStr = String(MAX_PATH, 0)
'returns 1 when successfull, 0 when failed
Ret = SearchTreeForFile("c:\", "Acrobat.exe", tempStr)
If Ret <> 0 Then
MsgBox "Located file at " + Left$(tempStr, InStr(1, tempStr, Chr$(0)) - 1)
Else
MsgBox "File not found!"
End If
End Sub
-
Apr 14th, 2006, 12:39 PM
#4
Thread Starter
Frenzied Member
Re: Want to find installation location
Frans C and Hack
Thanks a lot!
I tried Frans C 's idea, it worked for me.
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
|