WINDOWS注销关机消息

来源:互联网 发布:灵格斯 mac 编辑:程序博客网 时间:2024/04/29 21:29

用WM_QUERYENDSESSION.
在你的主框架窗口类中使用.

// in the class header
afx_msg BOOL OnQueryEndSession( WPARAM wReserved, LPARAM lEndReason );

// in the Message Map
ON_MESSAGE( WM_QUERYENDSESSION, OnQueryEndSession )

// in the class body
BOOL CMainFrame::OnQueryEndSession( WPARAM wReserved, LPARAM lEndReason )
{
    if( lEndReason =3D=3D ENDSESSION_LOGOFF ) {
        // user is logging off
    else
        // Windows is going down

    return( bCanExit );
}

原创粉丝点击