title image


Smiley Re: Eine andere Exe-Datei über VB schließen!
Hi,



mit dem Code kannst Du festestellen ob ein Prozess noch läuft. Schau mal bei www.activevb.de vorbei, da findest

Du bestimmt was.



Option Explicit



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 GetExitCodeProcess Lib "kernel32" _

(ByVal hProcess As Long, lpExitCode As Long) As Long



Const STILL_ACTIVE = &H103

Const PROCESS_ALL_ACCESS = &H1F0FFF



Dim TaskID&



Private Function IsActive() As Boolean

Dim Handle&, ExitCode&



Handle = OpenProcess(PROCESS_ALL_ACCESS, False, TaskID)

Call GetExitCodeProcess(Handle, ExitCode)

Call CloseHandle(Handle)



IsActive = IIf(ExitCode = STILL_ACTIVE, True, False)

End Function



Private Sub Command1_Click()

TaskID = Shell("notepad.exe", vbNormalFocus)

Timer1.Interval = 500

Timer1.Enabled = True

Command1.Enabled = False

End Sub



Private Sub Timer1_Timer()

Static z&



If IsActive Then

Me.Caption = "NotePad Läuft noch"

Else

Me.Caption = "NotePad Läuft nicht mehr"

Timer1.Enabled = False

Command1.Enabled = True

End If



z = z + 1

Label1.Caption = z

End Sub



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: