Try my new website:
www.urcho.com
- the new SIMPLE social network
Sign up
|
284
members |
114
snippets
Search for:
ALL
POPULAR
File Controls
Multiplayer Code
2D Effects
3D Effects
Oldskool demos
Basic Functions
Maths/Physics
Sound
Tutorials
Misc
Username:
Password:
Sign up
Self-Destructing .exe by Subirenihil
[
back
]
Author:
Archive
| Viewed:
974
times | Language:
BlitzBasic 3D
| Category:
File Controls
;Compile in its own folder as "Self-Destruct.exe" ;Run the compiled version and it will delete itself ; ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ;!! DO NOT RUN FROM WITHIN BLITZ !! ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ;The following lines must be in shell32.decls ; .lib "shell32.dll" ; ShellExecute%(hwnd%,Operation$,File$,Parameters$,Directory$,ShowCmd%):"ShellExecuteA" Graphics 400,300,0,2 SetBuffer FrontBuffer() SelfDestruct Text 200,150,"Press any key to self destruct...",1,1 WaitKey End Function SelfDestruct() dir$=SystemProperty("appdir") If Right$(dir$,1)<>"\" Then dir$=dir$+"\" tempdir$=SystemProperty("tempdir") If Right$(tempdir$,1)<>"\" Then tempdir$=tempdir$+"\" file$=dir$+"Self-Destruct.exe" temp$=tempdir$+"_uninstSelf-Destruct.bat" bat=WriteFile(temp$) WriteLine bat,":Repeat" WriteLine bat,"del "+Chr$(34)+file$+Chr$(34) WriteLine bat,"if exist "+Chr$(34)+file$+Chr$(34)+" goto Repeat" WriteLine bat,"rmdir "+Chr$(34)+Left$(dir$,Len(dir$)-1)+Chr$(34) WriteLine bat,"del "+Chr$(34)+temp$+Chr$(34) CloseFile bat ShellExecute 0,"open",Chr$(34)+temp$+Chr$(34),"","",0 End Function
Author Comments:
Be sure to add the proper lines to shell32.decls Compile into an empty folder, then run the compiled version to see it self-destruct. Not sure what would happen if you try to run by just hitting "F5" in the editor - could be very bad (as in deleting part of blitz).
Login or
create an account
to comment on this snippet