FindExecutable

機能
指定の拡張子と関連付けられている実行プログラム名を取得する
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" _
(ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" _
(ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Integer

HINSTANCE FindExecutable(
LPCTSTR lpFile,
LPCTSTR lpDirectory,
LPTSTR lpResult

);

引数
lpFile

指定の拡張子を持つファイル名
lpDirectory
デフォルトのディレクトリ
vbNullStringを指定したときはカレントディレクトリ
lpResult
(戻り値)プログラム名を受け取るバッファ
戻り値
正常終了のとき  32以上
エラーのとき               31以下の定数
サンプル
ダウンロード(FindExecutable.lzh 1.88KB)

戻り値の定数

0                                       メモリ不足
ERROR_FILE_NOT_FOUND = 2                ファイルが見つからない
ERROR_PATH_NOT_FOUND = 3                パスが見つからない
ERROR_BAD_FORMAT = 11                   ファイルが無効
31                                      関連付けられているファイルがない