• 新浪微博:
  • 微信 :
按键精灵电脑版
立即下载

软件版本:2014.06
软件大小:22.9M
更新时间:03-18

按键精灵安卓版
立即下载

软件版本:3.3.6
软件大小:62.5M
更新时间:01-16

按键精灵iOS版
立即下载

软件版本:1.3.8
软件大小:29.2M
更新时间:06-14

最新企业版UiBot
立即下载

软件版本:3.3
软件大小:282M
更新时间:08-06

快捷导航

登录 后使用快捷导航
没有帐号? 注册

登录 注册
发新话题 回复该主题

【VB源码】运行退出时删除自身程序 [复制链接]

1#
运行退出时删除自身程序

  1. (完美)
  2. 模块
  3. Const NORMAL_PRIORITY_CLASS = &H20
  4. Const REALTIME_PRIORITY_CLASS = &H100
  5. Const THREAD_PRIORITY_NORMAL = 0
  6. Const THREAD_PRIORITY_IDLE = -15
  7. Const IDLE_PRIORITY_CLASS = &H40
  8. Const DETACHED_PROCESS = &H8
  9. Const CREATE_SUSPENDED = &H4
  10. Const THREAD_PRIORITY_TIME_CRITICAL = 15
  11. Const SW_HIDE = 0
  12. Const STARTF_USESHOWWINDOW = &H1
  13. Type STARTUPINFO
  14. cb As Long
  15. lpReserved As String
  16. lpDesktop As String
  17. lpTitle As String
  18. dwX As Long
  19. dwY As Long
  20. dwXSize As Long
  21. dwYSize As Long
  22. dwXCountChars As Long
  23. dwYCountChars As Long
  24. dwFillAttribute As Long
  25. dwFlags As Long
  26. wShowWindow As Integer
  27. cbReserved2 As Integer
  28. lpReserved2 As Long
  29. hStdInput As Long
  30. hStdOutput As Long
  31. hStdError As Long
  32. End Type
  33. Type PROCESS_INFORMATION
  34. hProcess As Long
  35. hThread As Long
  36. dwProcessId As Long
  37. dwThreadId As Long
  38. End Type
  39. Type SECURITY_ATTRIBUTES
  40. nLength As Long
  41. lpSecurityDescriptor As Long
  42. bInheritHandle As Long
  43. End Type
  44. Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
  45. Declare Function GetEnvironmentVariable Lib "kernel32" Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpBuffer As String, ByVal nSize As Long) As Long
  46. Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
  47. Declare Function GetCurrentProcess Lib "kernel32" () As Long
  48. Declare Function GetCurrentThreadId Lib "kernel32" () As Long
  49. Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long
  50. Declare Function SetThreadPriority Lib "kernel32" (ByVal hThread As Long, ByVal nPriority As Long) As Long
  51. Declare Function ResumeThread Lib "kernel32" (ByVal hThread As Long) As Long
  52. Declare Function GetCurrentThread Lib "kernel32" () As Long
  53. Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
  54. Public Function DeleteMe() As Boolean
  55. Dim szModule As String
  56. Dim szComspec As String
  57. Dim szParams As String
  58. Dim si As STARTUPINFO
  59. Dim pi As PROCESS_INFORMATION
  60. Dim sa1 As SECURITY_ATTRIBUTES
  61. Dim sa2 As SECURITY_ATTRIBUTES
  62. szModule = String(512, 0)
  63. szComspec = String(512, 0)
  64. szParams = String(512, 0)

  65. '// get file path names:
  66. If ((GetModuleFileName(0, szModule, 512)

发新话题 回复该主题