Hi,
na ja, also nochmal:
' Wenn du es per Shell aufrufen willst:
Sub myCommand_Click()
Shell "c:\programme\mein programm\meinprogramm.exe", vbNormalFocus
End Sub
' Wenn du warten willst, bis das Programm zu Ende gelaufen ist:
'zunächst die benötigten API-Deklarationen
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib _
"kernel32" (ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Private Const INFINITE = &HFFFF
Private Const SYNCHRONIZE = &H100000
'Warten bis Anwendung beendet
Public Sub AppStartAndWait(ByVal sFile As String, _
ByVal WindowStyle As Long)
'Parameterbeschreibung
'sFile: Anwendung, die gestartet werden soll
'wStyle: Darstellungsart des Anwendungsfensters
Dim lRetVal As Long
Dim lHandle As Long
Dim lRet As Long
lRetVal = Shell(sFile, wStyle)
If lRetVal <> 0 Then
lHandle = OpenProcess(SYNCHRONIZE, 0, lRetVal)
If lHandle <> 0 Then
lRet = WaitForSingleObject(lHandle, INFINITE)
CloseHandle (lHandle)
End If
End If
End Sub
Sub myCommand_Click()
AppStartAndWait "c:\programme\mein programm\meinprogramm.exe", vbNormalFocus
End Sub
MfG
Rouven
--
-------------------
ss:) zu:) ls:& fo:) de:< va:{ ch:? sh:) n4:( rl:? br:$ js:| ie:) fl:(