⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pddpwb.cpp

📁 此代码为WCE5.0下电源管理的源代码
💻 CPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//

#include <pmimpl.h>

// This routine determines how many listeners there are for a particular 
// class of notifications.  If none, it returns zero.  A listener for any
// of the bits in dwMask will get counted once, regardless of how many
// mask bits match.
DWORD 
GetNotificationRequestCount(DWORD dwMask)
{
    PPOWER_NOTIFICATION ppn;
    DWORD dwCount = 0;
    
    PMLOCK();
    for(ppn = gpPowerNotifications; ppn != NULL; ppn = ppn->pNext) {
        if((ppn->dwFlags & dwMask) != 0) {
            dwCount++;
        }
    }
    PMUNLOCK();

    return dwCount;
}
// This routine determines how to react to Power Button Press Notification 
// from Others.
DWORD gdwCurTickCount = 0;
BOOL SuspendButtonPressed(BOOL bReleaseSupported)
{
    if (bReleaseSupported) {
        gdwCurTickCount = GetTickCount();
    }
    else {
        // Treat this as external request.
        DWORD dwStatus = PmSetSystemPowerState_I(NULL, POWER_STATE_SUSPEND, 0, FALSE );
        DEBUGCHK(dwStatus == ERROR_SUCCESS);
    }
    return TRUE;
}
// This routine determines how to react to Power Button Release Notification 
// from Others if it is supported.
BOOL  SuspendButtonReleased(BOOL bReleaseSupported)
{
    if (bReleaseSupported) {
        // Treat this as external request.
        DWORD dwStatus = PmSetSystemPowerState_I(NULL, POWER_STATE_SUSPEND, 0, FALSE );
        DEBUGCHK(dwStatus == ERROR_SUCCESS);
    }
    return TRUE;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -