Results 1 to 4 of 4

Thread: [RESOLVED] Want to find installation location

  1. #1

    Thread Starter
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Resolved [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:
    1. 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.

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    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.
    Frans

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Want to find installation location

    You can also use this API to locate a file.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SearchTreeForFile Lib "imagehlp" _
    4. (ByVal RootPath As String, ByVal InputPathName As String, _
    5. ByVal OutputPathBuffer As String) As Long
    6.  
    7. Private Const MAX_PATH = 260
    8.  
    9. Private Sub Command1_Click()
    10.     Dim tempStr As String, Ret As Long
    11.     'create a buffer string
    12.     tempStr = String(MAX_PATH, 0)
    13.     'returns 1 when successfull, 0 when failed
    14.     Ret = SearchTreeForFile("c:\", "Acrobat.exe", tempStr)
    15.     If Ret <> 0 Then
    16.         MsgBox "Located file at " + Left$(tempStr, InStr(1, tempStr, Chr$(0)) - 1)
    17.     Else
    18.         MsgBox "File not found!"
    19.     End If
    20. End Sub

  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width