Hi @ all!
Finally i found a way how to delete your running app automatical, like some uninstallers do the job. I need this routine for an own install/uninstaller system and think maybe someone is interested to learn about the following (maybe danger) code...
Maybe there is any other and better methode... But i dont know and for the first time it seems to works fine...
Code: Select all
; ------------------------------------------------------------
;
; PureBasic Win32 API - MyDeleteRunningApp - Example v1.0
;
; by MrVainSCL! aka Thorsten 19/Jan/2003 PB v3.51+
;
; ------------------------------------------------------------
;
Procedure MyDeleteRunningApp()
;
; -------- Get application filename --------
;
a$ = Space(1024)
GetModuleFilename_(0,@a$,1024)
appname$ = GetFilePart(a$)
;
; -------- Create script file (uninstall) --------
;
OpenFile(0,"tmp.bat")
WriteStringN(":loop")
WriteStringN("del "+appname$) ;programm.exe")
WriteStringN("if exist "+appname$+" Goto loop")
WriteStringN("del tmp.bat")
CloseFile(0)
;
; -------- Execute script and delete running app --------
;
ShellExecute_(0,"open","tmp.bat",0,0,#SW_SHOW)
;
EndProcedure
;
; -------- We will quit, so delete running app --------
;
MessageRequester("Delete running app","Will now delete your running app!",0)
MyDeleteRunningApp()
End
;
; ------------------------------------------------------------
PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...
greetz
MrVainSCL! aka Thorsten