| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2534 人关注过本帖
标题:[原创]我做的一个定时关机器,请指教
只看楼主 加入收藏
rainy312
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2006-3-8
收藏
得分:0 
    支持!学习学习,找个时间让偶也做个玩玩...

2006-03-15 15:53
a59936758
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2007-4-13
收藏
得分:0 
给原代码给学习。不关对不对。先顶再说

咋学学不会.还就偏要学
2007-04-18 14:15
a59936758
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2007-4-13
收藏
得分:0 
太简陋了大姐

咋学学不会.还就偏要学
2007-04-18 17:09
没有道理
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2006-7-3
收藏
得分:0 

shutdown 命令也是有权限的
如果登陆的用户不是超级用户的话
这个程序即使在XP也是不好使的


2007-04-18 19:38
redice
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:902
专家分:0
注 册:2006-12-11
收藏
得分:0 
对winxp或win2000扫描api函数能实现?

鲲鹏数据 - 专业Web数据采集服务提供者
http://www.
2007-04-18 21:21
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
16位Windows用ExitWindows() API函数,而32位Windows则用ExitWindowsEx().32位版本比16位版本多了更多的控制及选项,包括注销及关机。

Declare Function ExitWindows Lib "user" (ByVal uFlags As Long, ByVal _
dwReserved As integer) As integer
Const EW_REBOOTSYSTEM = &H43
Const EW_RESTARTWINDOWS = &H42

Sub Command1_Click()

Dim iAns As Integer
Dim rVal As Integer
Dim iButtonType as Integer

iButtonType = 4 + 32 ' vbYesNo + vbQuestion

' Ask if the user is sure they want to exit.
iAns = MsgBox("Are you sure you want to exit windows?", iButtonType, _
"Exit Windows")
If iAns = 6 Then ' Yes pressed
' Call the exit function to Reboot.
rVal = ExitWindows(EW_REBOOTSYSTEM, 0)
End If

End Sub

***** 32位的例子 *****
In a project with 1 commandbutton, place the following code:
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4

Private Sub Command1_Click()

Dim iAns As Integer
Dim rVal As Long

' Ask if the user is sure they want to exit.
iAns = MsgBox("Are you sure you want to exit windows?", vbQuestion Or _
vbYesNo, "Exit Windows")
If iAns = vbYes Then
rVal = ExitWindowsEx(EWX_SHUTDOWN, 0&)
End If

End Sub

学习需要安静。。海盗要重新来过。。
2007-04-20 16:55
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
改一下就可以定时关机了

学习需要安静。。海盗要重新来过。。
2007-04-20 17:13
Joforn
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:1242
专家分:122
注 册:2007-1-2
收藏
得分:0 
以下是引用sunkaidong在2007-4-20 16:55:33的发言:
16位Windows用ExitWindows() API函数,而32位Windows则用ExitWindowsEx().32位版本比16位版本多了更多的控制及选项,包括注销及关机。

Declare Function ExitWindows Lib "user" (ByVal uFlags As Long, ByVal _
dwReserved As integer) As integer
Const EW_REBOOTSYSTEM = &H43
Const EW_RESTARTWINDOWS = &H42

Sub Command1_Click()

Dim iAns As Integer
Dim rVal As Integer
Dim iButtonType as Integer

iButtonType = 4 + 32 ' vbYesNo + vbQuestion

' Ask if the user is sure they want to exit.
iAns = MsgBox("Are you sure you want to exit windows?", iButtonType, _
"Exit Windows")
If iAns = 6 Then ' Yes pressed
' Call the exit function to Reboot.
rVal = ExitWindows(EW_REBOOTSYSTEM, 0)
End If

End Sub

***** 32位的例子 *****
In a project with 1 commandbutton, place the following code:
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4

Private Sub Command1_Click()

Dim iAns As Integer
Dim rVal As Long

' Ask if the user is sure they want to exit.
iAns = MsgBox("Are you sure you want to exit windows?", vbQuestion Or _
vbYesNo, "Exit Windows")
If iAns = vbYes Then
rVal = ExitWindowsEx(EWX_SHUTDOWN, 0&)
End If

End Sub

你写出来准备关98的?


VB QQ群:47715789
2007-04-20 17:41
偶是天才
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-4-20
收藏
得分:0 
以下是引用a59936758在2007-4-18 17:09:12的发言:
太简陋了大姐

2007-04-20 19:06
fqqklwj
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-4-22
收藏
得分:0 

对啊,有没有突破shutdown权限的关闭程序
就是没是超级用户的也能用这个关机~~


学习中真是受益匪浅,努力~努力~
2007-07-07 21:20
快速回复:[原创]我做的一个定时关机器,请指教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036745 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved