title image


Smiley Re: Form nach Benutzung löschen?
Wollen wir wiedermal Spuren verwischen ? wurde aber letztens hier behandelt, Umweg über Batchfile machts möglich...



Den folgenden Code in ein Modul reinpacken und beim Beenden der Exe KillMe aufrufen...



Private Declare Function CreateProcess Lib "KERNEL32" Alias "CreateProcessA" (ByVal lpAppName As Long, ByVal lpCmdLine As String, ByVal lpProcAttr As Long, ByVal lpThreadAttr As Long, ByVal lpInheritedHandle As Long, ByVal lpCreationFlags As Long, ByVal lpEnv As Long, ByVal lpCurDir As Long, lpStartupInfo As STARTUPINFO, lpProcessInfo As PROCESS_INFORMATION) As Long

Private Declare Sub ZeroMemory Lib "KERNEL32" Alias "RtlMoveMemory" (dest As Any, ByVal numBytes As Long)

Private Const IDLE_PRIORITY_CLASS = &H40



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 Integer

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 Const SW_HIDE = 0

Private Const STARTF_USESHOWWINDOW = &H1



Public Sub KillMe()



Open App.Path + "\delme.bat" For Output As #1

Print #1, "@echo off"

Print #1, ": try"

Print #1, "del " + App.Path + "\" + App.EXEName + ".exe"

Print #1, "if exist " + App.Path + "\" + App.EXEName + ".exe goto try"

Print #1, "del " + App.Path + "\delme.bat"

Close #1



Dim si As STARTUPINFO

Dim pi As PROCESS_INFORMATION



'ZeroMemory si, Len(si)



si.cb = Len(si)

si.wShowWindow = SW_HIDE

si.dwFlags = STARTF_USESHOWWINDOW

CreateProcess 0&, App.Path + "\delme.bat", 0&, 0&, 0&, IDLE_PRIORITY_CLASS, 0&, 0&, si, pi

End

End Sub


Wer weiß schon, was er nicht weiß...(ich zähle mich auch dazu) Holger

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: