I know the question was for VB, but found a decent implementation of FindExecutable in C# here:
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace PaytonByrd {
public class Win32API
{
[DllImport("shell32.dll", EntryPoint="FindExecutable")]
public static extern long FindExecutableA(
string lpFile, string lpDirectory, StringBuilder lpResult);
public static string FindExecutable(
string pv_strFilename)
{
StringBuilder objResultBuffer =
new StringBuilder(1024);
long lngResult = 0;
lngResult =
FindExecutableA(pv_strFilename,
string.Empty, objResultBuffer);
if(lngResult >= 32)
{
return objResultBuffer.ToString();
}
return string.Format(
"Error: ({0})", lngResult);
}
}}
Here's a usage example:
using System;
using System.Diagnostics;
using System.IO;
using PaytonByrd;
namespace CSharpFindExecutableTester
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
foreach(string strFile in
Directory.GetFiles("c:\\"))
{
string strOutput =
string.Format(
"{0} - Application: {1}",
strFile,
Win32API.FindExecutable(
strFile));
Debug.WriteLine(strOutput);
}
}
}
}