现在的位置: 首页 > 综合 > 正文

WINDOWS注销关机消息

2013年07月12日 ⁄ 综合 ⁄ 共 384字 ⁄ 字号 评论关闭

用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 );
}

抱歉!评论已关闭.