程序自我销毁(VB源代码)

前端之家收集整理的这篇文章主要介绍了程序自我销毁(VB源代码)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Form窗体:

--------------------------------------------------------------------

Private Sub Form_Load()

Me.Hide
'可以在这中间插入你需要程序增加功能和指令
Call KillMe

End

End Sub

---------------------------------------------------------------------

Module代码

Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long,ByVal lpFileName As String,ByVal nSize As Long) As Long
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)


Public Sub KillMe()

Dim MyFilename As String
Dim tmp As String * 255
Dim l As Integer
l = GetModuleFileName(0,tmp,255)
MyFilename = Mid(tmp,1,l)

Shell "cmd /c ping 127.0.0.1 -n 1 && del """ & MyFilename & """",vbHide: ExitProcess (0) End Sub

原文链接:https://www.f2er.com/vb/261268.html

猜你在找的VB相关文章