Pada artikel kali ini saya akan membagikan sebuah kode untuk mencari aplikasi yang diasosiasikan terhadap sebuah file.
Option Explicit
Private Declare Function FindExecutableA Lib "shell32.dll" (ByVal lpFile As String, ByVal lpdirectory As String, ByVal lpResult As String) As Long
Private Const MAX_FILENAME_LEN = 256
Public Function FindExecutable(FileName As String) As String
Dim iReturn As Integer
Dim sResults As String
sResults = String(MAX_FILENAME_LEN, 32) & Chr$(0)
iReturn = FindExecutableA(FileName & Chr$(0), vbNullString, sResults)
If iReturn > 32 Then
FindExecutable = Left$(sResults, InStr(sResults, Chr$(0)) - 1)
Else
FindExecutable = ""
End If
End Function
Private Sub Form_Load()
MsgBox FindExecutable("c:\boot.ini")
End Sub
No comments:
Post a Comment