Hallo,
ich habe ein ganz dringendes Problem. Ich versuche eine Menüoberfläche in VB 4.0 zu programmieren. Aus der will ich AutoCad Zeichnungen aufrufen. Jetzt mein Problem:
Was für eine Syntax benötige ich um so eine Datei aufzurufen. Ich weiss ja nicht wo der Betrachter sein AutoCad installiert hat. Wie bringe ich dem Programm bei das bei einem Doppelklick in einer FileBox das korrekte Programm zum betrachten der Datei geöffnet wird ???
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Dim Scr\_hDC As Long
Dim strFile As String
strFile = "c:\temp\readme.txt"
Scr\_hDC = GetDesktopWindow()
Call ShellExecute(Scr\_hDC, "Open", strFile, "", "C:\", 1)
greets from MichL (Vienna)
[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]
Public Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Public Function DateiStarten(byval File as string)
Dim dok As String, exe As String, path As String, i As Long
On Error GoTo fehler
exe = Space(254) & Chr(0)
dok = File
path = App.path & "\help"
i = FindExecutable(dok, path, exe)
If i 42 Or Left(exe, 1) = Chr(0) Then
MsgBox "Keine Andwendung gefunden"
Else
Shell Left(exe, InStr(exe, Chr(0)) - 1) & " " & path & "\" & dok
End If
Exit Function
fehler:
If Err.Number = 53 Then
MsgBox "Die Datei wurde nicht gefunden!", vbCritical
Else
msgbox Err.Number & " " & Err.Description
End If
End Function
Public Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Public Function DateiStarten(byval mFile as string, byval mPath as string)
Dim dok As String, exe As String, path As String, i As Long
On Error GoTo fehler
exe = Space(254) & Chr(0)
dok = mFile
path = mpath
i = FindExecutable(dok, path, exe)
If i 42 Or Left(exe, 1) = Chr(0) Then
MsgBox "Keine Andwendung gefunden"
Else
Shell Left(exe, InStr(exe, Chr(0)) - 1) & " " & path & "\" & dok
End If
Exit Function
fehler:
If Err.Number = 53 Then
MsgBox "Die Datei wurde nicht gefunden!", vbCritical
Else
msgbox Err.Number & " " & Err.Description
End If
End Function