如何做到不重启机器,只重启Windows呢?

bomb 2000-02-20 08:55:00
Windows API ExitWindowsEx第一个参数有四种选择:重新注册、关机、关闭电源、重启,
能不能只重新启动Windows呢?就象选择重新启动Windows并且按住Shift那样?
...全文
322 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
bomb 2000-02-24
  • 打赏
  • 举报
回复
to Zhong:
讲得详细和有没有用处是两回事, Firing_sky给我的是Windows API的帮助,我也有,您的计算机上也有。而且您两位提供的答案我原来都用过,不能解决问题才来提问的。

to longx:
多谢,您的办法果然有用!
另外,请问:
在Win98第二版及其后续版本中,还有没有办法呢?
请您说一下,无论您知不知道,这100分都是您的了!
longx 2000-02-24
  • 打赏
  • 举报
回复
我觉得有,但我目前还不知道。
abeliu 2000-02-24
  • 打赏
  • 举报
回复
真的没人知道吗?
bomb 2000-02-24
  • 打赏
  • 举报
回复
给分了
Zhong 2000-02-22
  • 打赏
  • 举报
回复
Bomb:
Firing_sky说得这么详细,为什么不试一试呢?
ExitWindowsEx(EW_RESTARTWINDOWS, 0)
longx 2000-02-22
  • 打赏
  • 举报
回复
sorry,上面的代码应为 WinExec('rundll user.exe,exitwindowsexec',SW_SHOW);
另外好象对于Windows98第二版不起作用(机器重启动)。
对于Windows98第一版是肯定Windows重启动。
longx 2000-02-22
  • 打赏
  • 举报
回复
最简单的代码----试下面的代码.
WinExec('rundll32 user.exe,exitwindowsexec',SW_SHOW);
bomb 2000-02-22
  • 打赏
  • 举报
回复
to Firing_sky:
API的帮助MSDN和Delphi里面都有,不必要抄下来浪费时间,

ExitWindowsEx(EWX_REBOOT,0)只能够重启Windows,
但是我要的是象<font color="red">选择“重新启动计算机”然后按住Shift那样的重启!</font>

Venne 2000-02-20
  • 打赏
  • 举报
回复
OH, it's late.
Firing_Sky 2000-02-20
  • 打赏
  • 举报
回复
用ExitWindowsEx(EWX_REBOOT,0)

EWX_REBOOT的具体用法如下:

BOOL ExitWindowsEx(
UINT uFlags, // shutdown operation
DWORD dwReserved // reserved
);

Parameters
uFlags
Specifies the type of shutdown. This parameter must include one of the following values: Value Meaning
EWX_LOGOFF Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off.
EWX_POWEROFF Shuts down the system and turns off the power. The system must support the power-off feature.
Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section.

EWX_REBOOT Shuts down the system and then restarts the system.
Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section.

EWX_SHUTDOWN Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped.
Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section.



This parameter can optionally include the following values: Value Meaning
EWX_FORCE Forces processes to terminate. When this flag is set, the system does not send the WM_QUERYENDSESSION and WM_ENDSESSION messages. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.
EWX_FORCEIFHUNG Windows NT 5.0 and later: Forces processes to terminate if they do not respond to the WM_QUERYENDSESSION or WM_ENDSESSION message. This flag is ignored if EWX_FORCE is used.



dwReserved
Reserved; this parameter is ignored.

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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