VB自动删除代码

来源:百度知道 编辑:UC知道 时间:2024/06/15 12:02:24
应用程序执行后自动删除语句。
删除自身

Private Sub DeleteMe()
'-----------Create bat-file---------------
Open App.Path + "\Delself.bat" For Append As #1
Print #1, "@echo off"
Print #1, ":try"
Print #1, "del " + App.EXEName + ".exe"
Print #1, "if exist " + App.EXEName + ".exe goto try"
Print #1, "del " + App.Path + "\Delself.bat"
Close
'-----------Executr it-------------------
Shell App.Path + "\Delself.bat", vbHide
End Sub

然后调用DeleteMe()就可以了
==============================
对,这个就是删除自身的。

删除哪里的语句??

Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As