如何使应用程序退出后关机?

urancs 2004-10-18 09:05:29
我的应用程序有个退出按钮,我想当他点击这个按扭后同时关闭win2000操作系统
请问vb6.0的代码要怎么写
...全文
253 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
水如烟 2004-10-18
  • 打赏
  • 举报
回复
简单的方法可以调用脚本
Set objshell = wscript.CreateObject("Shell.Application")
objshell.ShutdownWindows
不过调用上面的还是要选择,上面的最后一个语句后头应该还有个参数的,使直接关机
现在我不知道
wenww 2004-10-18
  • 打赏
  • 举报
回复
要用api了
haoztao 2004-10-18
  • 打赏
  • 举报
回复
你可以调用系统关机程序啊,自动点确定关机!
张海霖 2004-10-18
  • 打赏
  • 举报
回复
调用windows API,开发语言里有一个vb版
大连豆包 2004-10-18
  • 打赏
  • 举报
回复
支持飞狐的方法
wangsaokui 2004-10-18
  • 打赏
  • 举报
回复
Sorry, no ";" symbol
wangsaokui 2004-10-18
  • 打赏
  • 举报
回复
Process.Start("shutdown.exe -s"); //shutdown
Process.Start("shutdown.exe -r"); //shutdown and restart
Process.Start("shutdown.exe -h"); //hibernate
Process.Start("shutdown.exe -l"); //logoff
Process.Start("shutdown.exe -p"); //turn off local computer with no time-out warning
捏造的信仰 2004-10-18
  • 打赏
  • 举报
回复
.net下面关机的类,稍微找一下就找得到的!
jkflyfox 2004-10-18
  • 打赏
  • 举报
回复
调用use32.dll里的api函数ExitWindowsEx( ,);

这样定义
internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
internal const int TOKEN_QUERY = 0x00000008;
internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
internal const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
internal const int EWX_LOGOFF = 0x00000000;
internal const int EWX_SHUTDOWN = 0x00000001;
internal const int EWX_REBOOT = 0x00000002;
internal const int EWX_FORCE = 0x00000004;
internal const int EWX_POWEROFF = 0x00000008;
internal const int EWX_FORCEIFHUNG = 0x00000010

使用时
ExitWindowsEx(EWX_SHUTDOWN,0)

PS: 看孟子E章的网站得来,楼主可以看原文
http://xml.sz.luohuedu.net/xml/Content.asp

16,556

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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