ファイル名からフルパスを取得するには

ファイル名からフルパスを取得してみます。
キーワードは「PathFindOnPath()関数」です。
PathFindOnPath()関数はファイル名を指定して、指定のディレクトリと
WindowsディレクトリとWindows/Systemディレクトリを探し、
見つかればそのフルパスを返します。

実行時の様子
'指定のファイルのフルパスを取得する
Private Declare Function PathFindOnPath Lib "shlwapi.dll" Alias "PathFindOnPathA" _
    (ByVal pszFile As String, pszOtherDirs As String) As Long

Private Sub Command1_Click() Dim temp As String, pszOtherDirs As String, rc As Long temp = Me.Text1.Text & String(256, Chr(0)) 'ファイル名とバッファの確保 pszOtherDirs = Me.Text2.Text rc = PathFindOnPath(temp, pszOtherDirs) '検索する If rc Then MsgBox temp, , "見つかりました" End If End Sub
Private Sub Form_Load() Me.Label4.Caption = "+" & vbCrLf & "Windowsディレクトリ" & _ vbCrLf & "+" & vbCrLf & "Windows/Systemディレクトリ" End Sub
ダウンロード