如何调用关机对话框
调用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);
}
具体代码如下:
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);
}