Visual Basic Tips


関連付けられたアプリケーションのパスを取得(API)


ファイルのパス名を指定すると、それに関連付けられたアプリケーションのパスを取得します。


Private Sub
Form_Load()
  
Dim strFilePath As String
  
Dim strExeFilePath As String * 80
  
Dim lngRet As Long

  strFilePath = App.Path & "\work.txt"

  lngRet = FindExecutable(strFilePath, 0, strExeFilePath)
  
If lngRet < 32 Then
  
Else
    MsgBox strExeFilePath
  
End If
End Sub

'----------------------------------------------------------
'
'----------------------------------------------------------
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long


DownLoad vbtips072.lzh 2KB (VB6.0)