调用Windows的关机对话框可用shell32.dll中一个索引号为60的API函数调用可实现。
具体代码如下:
typedef int (CALLBACK *SHUTDOWNDLG) (int);
CString s;
HINSTANCE hInst = LoadLibrary("shell32");
SHUTDOWNDLG SHShutDownDialog;
if(hInst != 0)
{
SHShutDownDialog = (SHUTDOWNDLG)GetProcAddress(hInst, (LPSTR)60);
(*SHShutDownDialog)(0);
FreeLibrary(hInst);
}
转载于:https://www.cnblogs.com/wangliang651/archive/2006/10/31/545295.html