永发信息网

VB6.0请问这么做出这样的脚步(图) 求大虾列出式子 谢谢&^^

答案:1  悬赏:20  手机版
解决时间 2021-05-02 01:05
VB6.0请问这么做出这样的脚步(图) 求大虾列出式子 谢谢&^^
最佳答案

Option Explicit
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As LUID) As Long
Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
Const TOKEN_ADJUST_PRIVILEGES = &H20
Const TOKEN_QUERY = &H8
Const SE_PRIVILEGE_ENABLED = &H2
Private Type LUID
UsedPart As Long
IgnoredForNowHigh32BitPart As Long
End Type
Private Type TOKEN_PRIVILEGES
PrivilegeCount As Long
TheLuid As LUID
Attributes As Long
End Type
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Const HELP_CONTENTS = &H3&
Const EWX_WAIT = 16
Const EWX_REBOOT = 2 '重起
Const EWX_LOGOFF = 0 '注销
Const EWX_FORCE = 4 '终止没有响应的进程
Const EWX_SHUTDOWN = 8 '关闭电源


Private Sub Command1_Click()
'重新启动计算机
ExitWindowsEx EWX_REBOOT, 0
End Sub


Private Sub Command2_Click()
'关闭计算机
ExitWindowsEx EWX_FORCE Or EWX_SHUTDOWN, 0
End Sub


Private Sub Command3_Click()
End
End Sub


Private Sub Command4_Click()
ExitWindowsEx EWX_LOGOFF, 0
End Sub
Private Sub Form_Load()
Dim hProcessHandle As Long
Dim hTokenHandle As Long
Dim tmpLuid As LUID
Dim tkpNew As TOKEN_PRIVILEGES
Dim tkpPrevious As TOKEN_PRIVILEGES
Dim lBufferNeeded As Long
'获取当前进程的一个伪句柄
hProcessHandle = GetCurrentProcess()
OpenProcessToken hProcessHandle, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hTokenHandle
LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuid
tkpNew.PrivilegeCount = 1
tkpNew.TheLuid = tmpLuid
tkpNew.Attributes = SE_PRIVILEGE_ENABLED
lBufferNeeded = 0
'允许当前应用程序有关闭操作系统的权限
AdjustTokenPrivileges hTokenHandle, False, tkpNew, Len(tkpPrevious), tkpPrevious, lBufferNeeded
End Sub




按照这样的界面试试

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
冒险岛刷钱去哪块
请问宜昌明天天气怎样,
影奔 GT240黑将×5版 使命召唤4和6特效全开顺
用什么笔写英文圆体字比较好?
给我推荐几个可以免费下载TXT电子书得网站要
DNF中的无奈
为什么我的回车键都没有任何反应
该原谅曾经深深伤害自已的人吗?
光华社区在什么地方啊,我要过去处理事情
若y=根号x的平方-4+根号4-x的平方除以x-2+16
在功夫之王上李连杰是不是真的将尿撒到成龙脸
为什么说乔布斯改变了4个行业?
是我自作多情吗
BFS牛汇买卖对盘是什么意思?
魔兽世界2区桑德兰联盟进
推荐资讯
爱国的名言警句和诗句,我想分别送给铁罐和陶
指环王ol多少意志等于10点光辉?
上河口地址在什么地方,想过去办事
北京到承德坐大客走高速去哪坐
地下城里的附魔有什么用?
云南人玩龙之谷喜欢在哪区
QQ农场种葫芦有什么奖励吗?还是有种葫芦换动
车饰界极致美颜在哪里啊,我有事要去这个地方
梦到父亲和我正在砍小树,用来作车,是吉是凶
栗树嘴村我想知道这个在什么地方
今天火箭与勇士的比分是多少
假如面对人家介绍给我对象,不知道选择哪个才
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?