Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application paths

Status
Not open for further replies.

tetorvik

Programmer
Sep 6, 2001
13
FI
How to find out the full path of an application (not the runnig one but others like IEXPLORER.EXE) if only *.exe file in known?

Thanks!
 
Hi,

Here's some code that Elziko posted long time ago:
-----------------------------------------------
Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Public Function GetExe(file As String) As String
Dim sExec As String * 255
Dim lRetVal As Long
Dim iFN As Integer
Dim sTemp As String
sExec = Space(255)
' Then find the application associated with it.
lRetVal = FindExecutable(file, sTemp, sExec)
' If an application return the name
If lRetVal <= 32 Or IsEmpty(sExec) Then ' Error
Stop
Else
GetExe = Left(Trim$(sExec), Len(Trim$(sExec)) - 1)
End If
End Function
--------------------------------------------------------- Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top