title image


Smiley Re: Programm mit Visual Basic beenden!
versuch mal das :





Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long

Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long



Private Type STARTUPINFO

cb As Long

lpReserved As String

lpDesktop As String

lpTitle As String

dwX As Long

dwY As Long

dwXSize As Long

dwYSize As Long

dwXCountChars As Long

dwYCountChars As Long

dwFillAttribute As Long

dwFlags As Long

wShowWindow As Integer

cbReserved2 As Integer

lpReserved2 As Byte

hStdInput As Long

hStdOutput As Long

hStdError As Long

End Type



Private Type PROCESS_INFORMATION

hProcess As Long

hThread As Long

dwProcessId As Long

dwThreadId As Long

End Type



Private procid As Long



Private Sub Command1_Click()



Dim pi As PROCESS_INFORMATION

Dim si As STARTUPINFO

Dim l As Long



l = CreateProcess(0&, "notepad.exe", 0&, 0&, 1&, &H20, 0&, 0&, si, pi)

procid = pi.hProcess



End Sub



Private Sub Command2_Click()



TerminateProcess procid, 0



End Sub



Private Sub Form_Load()



End Sub



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: