Facebook Sharer
选择您要替换的背景颜色:
【农历新年】背景图片:
个性化设定
 注册  找回密码
查看: 4501|回复: 29
打印 上一主题 下一主题

vb.net auto shutdown PC

[复制链接]

13

主题

0

好友

2113

积分

白金长老

Rank: 10

跳转到指定楼层
1#
发表于 2008-8-9 11:00 PM |只看该作者 |正序浏览
vb6


  1. Private Const EWX_LOGOFF = 0
  2. Private Const EWX_SHUTDOWN = 1
  3. Private Const EWX_REBOOT = 2
  4. Private Const EWX_FORCE = 4
  5. Private Const TOKEN_ADJUST_PRIVILEGES = &H20
  6. Private Const TOKEN_QUERY = &H8
  7. Private Const SE_PRIVILEGE_ENABLED = &H2
  8. Private Const ANYSIZE_ARRAY = 1
  9. Private Const VER_PLATFORM_WIN32_NT = 2

  10. Type OSVERSIONINFO
  11. dwOSVersionInfoSize As Long
  12. dwMajorVersion As Long
  13. dwMinorVersion As Long
  14. dwBuildNumber As Long
  15. dwPlatformId As Long
  16. szCSDVersion As String * 128
  17. End Type

  18. Public Type LUID
  19. LowPart As Long
  20. HighPart As Long
  21. End Type

  22. Public Type LUID_AND_ATTRIBUTES
  23. pLuid As LUID
  24. Attributes As Long
  25. End Type

  26. Public Type TOKEN_PRIVILEGES
  27. PrivilegeCount As Long
  28. Privileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTES
  29. End Type

  30. Private Declare Function GetCurrentProcess Lib "kernel32.dll" () As Long
  31. Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal
  32. ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
  33. Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As LUID) As Long
  34. Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As
  35. TOKEN_PRIVILEGES, ReturnLength As Long) As Long Private Declare Function ExitWindowsEx Lib "user32.dll" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
  36. Private Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long

  37. Private Sub EnableShutDown()
  38. Dim hProc As Long
  39. Dim hToken As Long
  40. Dim mLUID As LUID
  41. Dim mPriv As TOKEN_PRIVILEGES
  42. Dim mNewPriv As TOKEN_PRIVILEGES

  43. hProc = GetCurrentProcess()
  44. OpenProcessToken hProc, TOKEN_ADJUST_PRIVILEGES + TOKEN_QUERY, hToken
  45. LookupPrivilegeValue "", "SeShutdownPrivilege", mLUID
  46. mPriv.PrivilegeCount = 1
  47. mPriv.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
  48. mPriv.Privileges(0).pLuid = mLUID
  49. AdjustTokenPrivileges hToken, False, mPriv, 4 + (12 *
  50. mPriv.PrivilegeCount), mNewPriv, 4 + (12 * mNewPriv.PrivilegeCount)
  51. End Sub

  52. Public Sub ShutDownNT(Force As Boolean)
  53. Dim Ret As Long
  54. Dim flags As Long

  55. flags = EWX_SHUTDOWN
  56. If Force Then flags = flags + EWX_FORCE
  57. EnableShutDown
  58. ExitWindowsEx flags, 0
  59. End Sub

  60. Public Sub RebootNT(Force As Boolean)
  61. Dim Ret As Long
  62. Dim flags As Long

  63. flags = EWX_REBOOT
  64. If Force Then flags = flags + EWX_FORCE
  65. EnableShutDown
  66. ExitWindowsEx flags, 0
  67. End Sub

  68. Public Sub LogOffNT(Force As Boolean)
  69. Dim Ret As Long
  70. Dim flags As Long

  71. flags = EWX_LOGOFF
  72. If Force Then flags = flags + EWX_FORCE
  73. ExitWindowsEx flags, 0
  74. End Sub

复制代码


vb.net
要引进
在referance 里

imports System.Diagnostics

  1. System.Diagnostics.Process.Start("Shutdown", "/s")
复制代码




收藏收藏0

62

主题

5

好友

3715

积分

本站名嘴

Rank: 11Rank: 11

30#
发表于 2008-9-13 11:38 PM |只看该作者

回复 #29 饿魔 的帖子

用 visual basic compliter 来 转换成exe


回复

使用道具 举报

16

主题

2

好友

2291

积分

白金长老

Rank: 10

29#
发表于 2008-9-13 09:28 PM |只看该作者
要怎么运行...em0015


回复

使用道具 举报

62

主题

5

好友

3715

积分

本站名嘴

Rank: 11Rank: 11

28#
发表于 2008-8-28 10:58 PM |只看该作者

回复 #27 dious 的帖子

为什么呢?乱delete东西?我最怕这种东西的
我的autoclicker等等全部给他delete掉
还Clean 《清洗,= =


回复

使用道具 举报

3

主题

0

好友

7984

积分

百变名嘴

Rank: 13Rank: 13Rank: 13Rank: 13

27#
发表于 2008-8-26 11:04 PM |只看该作者
原帖由 goodhermit95 于 2008-8-24 07:51 PM 发表
NOD32(Eset Smart Security 3.0) 《《ARRAY   永久破解

nod啊

那很好

千萬不要用最新版的kaspersky 2009


回复

使用道具 举报

13

主题

0

好友

2113

积分

白金长老

Rank: 10

26#
发表于 2008-8-26 12:05 AM |只看该作者
原帖由 暗杀天使 于 2008-8-25 12:49 PM 发表
印象中("Shutdown -a")是破解对吗~以前有看朋友玩过~~


这个只是把 要关机倒数时, 强制的 中断倒数关机


回复

使用道具 举报

51

主题

3

好友

3207

积分

本站名嘴

Rank: 11Rank: 11

25#
发表于 2008-8-25 12:49 PM |只看该作者
印象中("Shutdown -a")是破解对吗~以前有看朋友玩过~~


回复

使用道具 举报

62

主题

5

好友

3715

积分

本站名嘴

Rank: 11Rank: 11

24#
发表于 2008-8-24 07:51 PM |只看该作者

回复 #23 dious 的帖子

NOD32(Eset Smart Security 3.0) 《《ARRAY   永久破解


回复

使用道具 举报

3

主题

0

好友

7984

积分

百变名嘴

Rank: 13Rank: 13Rank: 13Rank: 13

23#
发表于 2008-8-24 01:09 AM |只看该作者

回复 #22 goodhermit95 的帖子

對了

你使用什么antivirus


回复

使用道具 举报

62

主题

5

好友

3715

积分

本站名嘴

Rank: 11Rank: 11

22#
发表于 2008-8-22 07:20 PM |只看该作者

回复 #21 dious 的帖子

不会啦
只要有做好防备,很安全的


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

JBTALKS.CC |联系我们 |隐私政策 |Share

GMT+8, 2025-1-25 06:52 PM , Processed in 0.109957 second(s), 27 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

Ultra High-performance Dedicated Server powered by iCore Technology Sdn. Bhd.
Domain Registration | Web Hosting | Email Hosting | Forum Hosting | ECShop Hosting | Dedicated Server | Colocation Services
本论坛言论纯属发表者个人意见,与本论坛立场无关
Copyright © 2003-2012 JBTALKS.CC All Rights Reserved
合作联盟网站:
JBTALKS 马来西亚中文论坛 | JBTALKS我的空间 | ICORE TECHNOLOGY SDN. BHD.
回顶部