ZjiÜt∞nφ aplikace asociovanΘ k souboru

Postup:
V deklaraΦnφ Φßsti formulß°e zapiÜte:

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

Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const ERROR_BAD_FORMAT = 11&

Na formulß° p°idejte tlaΦφtko a na jeho udßlost Click:
Private Sub Command1_Click()

   Dim lpExecutable As String * 255
   Dim lngReturn As Long
   lngReturn = FindExecutable("c:\xx.psp", vbNullString, lpExecutable)

   Select Case lngReturn
      Case 0
         MsgBox "Chyba systΘmu."
      Case 31
         MsgBox "Chyba systΘmu."
      Case ERROR_FILE_NOT_FOUND
         MsgBox " Soubor nebyl nalezen."
      Case ERROR_PATH_NOT_FOUND
         MsgBox "Specifikovanß cesta nebyla nalezena."
      Case ERROR_BAD_FORMAT
         MsgBox "EXE soubor je chybn² (nenφ Win32 nebo je poÜkozen²)."
      Case Else
         MsgBox lpExecutable
   End Select

End Sub

Zp∞t

Autor: The Bozena