Visual c++ 2008编写关机程序

来源:百度知道 编辑:UC知道 时间:2024/06/24 12:15:45
现在在vc++2008下创建一个windows窗口,然后加入一个BUTTON,BUTTON的text属性为关机,要求是点击这个Button的时候,使用windows自带的shutdown.exe来关机。现求这个代码。

用这个:
BOOL WINAPI CreateProcess(
__in LPCTSTR lpApplicationName,
__in_out LPTSTR lpCommandLine,
__in LPSECURITY_ATTRIBUTES lpProcessAttributes,
__in LPSECURITY_ATTRIBUTES lpThreadAttributes,
__in BOOL bInheritHandles,
__in DWORD dwCreationFlags,
__in LPVOID lpEnvironment,
__in LPCTSTR lpCurrentDirectory,
__in LPSTARTUPINFO lpStartupInfo,
__out LPPROCESS_INFORMATION lpProcessInformation
);

有关机的API可以调用。