Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

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



Application Security Testing: An Integral Part of DevOps

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
        key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey( _
            "Software\Microsoft\Windows\CurrentVersion\App Paths\" & exeName)
        Return key.GetValue("")
    Catch e As Exception
        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.



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