很简单的问题(送分哦)

tiancan 2002-09-08 10:17:36
在VB中有没有可调用的这种API函数呢?
关闭所有应用程序,强制“重新启动计算机并切换到MS-DOS(M)”
在线等待,,谢谢啦!
...全文
48 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tiancan 2002-09-08
  • 打赏
  • 举报
回复
D_Q(A.dai)
我想问的是在98系统下
谢谢各位啦!
dsclub 2002-09-08
  • 打赏
  • 举报
回复
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags as Long, ByVal wReserved as Long) as Long
Private Const EWX_FORCE = 4 'Force any applications to quit instead of prompting the user to close them.
Private Const EWX_POWEROFF = 8 'Shut down the system and, if possible, turn the computer off.
Private Const EWX_LOGOFF = 0 'Log off the network
Private Const EWX_REBOOT = 2 'Perform a full reboot of the system
Private Const EWX_SHUTDOWN = 1 'Shut down the system
'Purpose : Forces a machine shut down/logoff
'Inputs : [lShutDownType] If unspecified, will reboot the machine else one of the above constants
'Outputs : If successful returns a number other than zero
'Author : Andrew Baker
'Date : 31/01/2001 14:35
'Notes :
'Revisions :
Function MachineShutDown(Optional lShutDownType As Long = EWX_REBOOT) As Long
MachineShutDown = ExitWindowsEx(EWX_SHUTDOWN, 0&) 'shut down the computer
End Function
'Demonstration routine
Sub Test()
'Forces the computer to reboot
Call MachineShutDown(EWX_REBOOT)
'Forces the user to log off
Call MachineShutDown(EWX_LOGOFF)
'Shuts the computer down (no restart)
Call MachineShutDown(EWX_SHUTDOWN)
'Shuts the computer down and turns power off (if possible)
Call MachineShutDown(EWX_POWEROFF)
End Sub
huxiangming 2002-09-08
  • 打赏
  • 举报
回复
使用api ExitWindowsEx 关机时里面的参数中就有你要求的功能。

EWX_FORCE=4; //关闭所有程序并以其他用户身份登录
EWX_LOGOFF=0; //重新启动计算机并切换到MS-DOS方式
EWX_REBOOT=2; //重新启动计算机
EWX_SHUTDOWN=1;//关闭计算机
D_Q 2002-09-08
  • 打赏
  • 举报
回复
你说的强制到MS DOS 有没有考虑过 98以外的系统是否可行?
D_Q 2002-09-08
  • 打赏
  • 举报
回复
当然可以调用API你要 调用什么?
==================================================
广告宣传:
闪客必备工具 - 矢量图共享(V1.07)
去除Flash 编译过的 SWF文件 的密码 使矢量共享,从EXE中分离SWF文件,SWF文件分析,支持Flash 5\Flash MX
http://www.csdn.net/cnshare/soft/13/13646.shtm 马上下载呀!

7,765

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧