Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB7
Expertise: Intermediate
May 5, 2003

GetApplicationPath - Retrieving the path of a Windows application

' Get the path of a Windows application or an empty string if the application 
' isn't registered
'
' This routine only works for those applications that register themselves under 
' the registry key
' HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths
'
' You can use it to retrieve the path of all MSOffice apps, MS Access,
'  SQl Server, Windows Dialer, 
' and more, for example Run Excel in a maximized window:
'    Process.Start(GetApplicationPath("EXCEL.EXE"))

Function GetApplicationPath(ByVal exeName As String) As String
    Dim key As Microsoft.Win32.RegistryKey
    Try
        key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey( _
            "Software\Microsoft\Windows\CurrentVersion\App Paths\" & exeName)
        Return key.GetValue("")
    Catch e As Exception
    Finally
        If Not key Is Nothing Then key.Close()
    End Try
End Function
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date