2010-05-17 4 views

답변

1

나는 (당신이 FindExecutable API 함수를 사용하여 같은 것을 할 수 있다고 생각 먼저 c : \ temp에 test.zip이라는 파일을 작성하십시오. 이 정보는 this 링크에서 가져 왔습니다.

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

Private Sub Form_Load() 
Dim i As Integer, s2 As String 
Const sFile = "C:\\temp\\test.zip" 

'Check if the file exists 
If Dir(sFile) = "" Or sFile = "" Then 
MsgBox "File not found!", vbCritical 
Exit Sub 
End If 
'Create a buffer 
s2 = String(MAX_FILENAME_LEN, 32) 
'Retrieve the name and handle of the executable, associated with this file 
i = FindExecutable(sFile, vbNullString, s2) 
If i > 32 Then 
MsgBox Left$(s2, InStr(s2, Chr$(0)) - 1) 
Else 
MsgBox "No association found !" 
End If 
End Sub 
0

요구 사항이나 상황이 무엇인지 모르겠지만 대개 외부 도구를 호출 할 때 경로와 매개 변수를 구성 할 수 있습니다. 즉, WinZip이 설치되어 있지 않은 경우 프로그램 운영자가 WinRAR을 사용하도록 응용 프로그램을 구성 할 수 있습니다.

구성 메커니즘을 이미 설정 한 경우 구현하기가 쉽고 특정 소프트웨어에 대해 하드 코딩하는 것보다 훨씬 유연해야합니다.

1

은이 경로에서 레지스트리 키를 읽기 :

HKEY_LOCAL_MACHINE\SOFTWARE\Nico Mak Computing\WinZip\Program\zip2exe 

은 WinZip을

에 대한 설치 경로입니다 의 경로
+0

+1, 정말 도움이 됨 –