January 1, 2005

WinTask - FindExecutable

'
' FindExectuable
'
' Author: Joe Strazzere
'
' "shell32.dll" Alias "FindExecutableA"
' (ByVal lpFile As String,
'  ByVal lpDirectory As String,
'  ByVal lpResult As String) As Long
'
Function FindExecutable$(File$)
  Local Exe$
  Local ret
  Exe$="                                                                                 "
  ret=External("shell32.dll", "FindExecutableA", File$, "", Exe$)
  If ret>32 then
   FindExecutable$=Exe$
  else
   FindExecutable$="NOT FOUND - Return code is "+Str$(ret)
  endif
EndFunction
MyFile$="d:wwf.doc"
Msgbox("The .exe that opens "+MyFile$+" is : "+FindExecutable$(MyFile$))