用什么函数关机? 我用ExitWindowsEx(EWX_LOGOFF,0);不好用。我记得在电脑报上有一个介绍:新建一个快捷方式,输入 Shell32.dll ...加入几个参数,可以实现关机。到底应该怎样办? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不用EWX_LOGOFF,用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 Res section. Shell32.dll ? 可以关机吗? rundll32 shell32.dll,SHExitWindowsEx (注销). rundll32 shell32.dll,SHExitWindowsEx1 (关机). rundll32 shell32.dll,SHExitWindowsEx 2 ( 重新启动电脑). 在Windows2000下实现有困难,还是自写一个函数吧!在Win2000下:void ShutDown(UINT uEWXFlag){ TOKEN_PRIVILEGES tkp,tkpnewbutignored; HANDLE hdltokenhandle; LUID tmpluid; BOOL rc; DWORD lbufferneeded; HANDLE hdlprocesshandle = GetCurrentProcess(); rc = OpenProcessToken(hdlprocesshandle,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hdltokenhandle); rc = LookupPrivilegeValue("","SeShutdownPrivilege", &tmpluid); tkp.PrivilegeCount = 1; tkp.Privileges[0].Luid = tmpluid; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; rc = AdjustTokenPrivileges(hdltokenhandle,FALSE,&tkp,sizeof(tkpnewbutignored),&tkpnewbutignored, &lbufferneeded); ExitWindowsEx(uEWXFlag,0);} 如何判断一个盘符是属于哪个磁盘驱动器的 请教关于VC 通过进程ID 获得相关EXE 的窗口句柄的问题。 如何刷新ListControl里的图标列表CImageList 请教一个放大或缩小图片局部的问题 单选按钮问题: 如何使单选按钮的背景设置为透明 拖动窗口时控件消失的问题 请问这句有何错误?见正文!谢谢 怎么可以去掉预编译头文件而不报错: 在查找预编译头指令时遇到意外的文件结尾 在ASP中使用数据库,究竟是什么用户身份?如何更改? 请教高手一个关于颜色对话框的问题!急! CreateWindow 创建分割条split,请指教!!! vc debug
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 Res section.
rundll32 shell32.dll,SHExitWindowsEx1 (关机). rundll32 shell32.dll,SHExitWindowsEx 2 ( 重新启动电脑).
{
TOKEN_PRIVILEGES tkp,tkpnewbutignored;
HANDLE hdltokenhandle;
LUID tmpluid;
BOOL rc;
DWORD lbufferneeded;
HANDLE hdlprocesshandle = GetCurrentProcess();
rc = OpenProcessToken(hdlprocesshandle,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hdltokenhandle);
rc = LookupPrivilegeValue("","SeShutdownPrivilege", &tmpluid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Luid = tmpluid;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
rc = AdjustTokenPrivileges(hdltokenhandle,FALSE,&tkp,sizeof(tkpnewbutignored),&tkpnewbutignored, &lbufferneeded);
ExitWindowsEx(uEWXFlag,0);
}