亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? statusregion.cpp

?? 一個WinCE6。0下的IP phone的源代碼
?? CPP
字號:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#include "StatusRegion.hpp"
#include "Common.hpp"
#include "Debug.hpp"
#include "Layout.hpp"
#include "Resource.h"


const UINT c_cmsMainTimer = 250;

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::StatusHeaderImpl_t

    Constructor.
------------------------------------------------------------------------------*/
StatusHeaderImpl_t::StatusHeaderImpl_t(
    )
{
    TRACE(ZONE_COMMON_CTOR);

    //clean out the message array
    ZeroMemory(m_Messages, sizeof(m_Messages));
    m_IndexActiveMessage = -1;
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::~StatusHeaderImpl_t

    Destructor.
------------------------------------------------------------------------------*/
StatusHeaderImpl_t::~StatusHeaderImpl_t(
    )
{
    TRACE(ZONE_COMMON_CTOR);

    //Free the strings in the array.
    for (int i = 0; i < _countof(m_Messages); i++)
    {
        ClearEntry(&m_Messages[i]);
    }
}

bool
StatusHeaderImpl_t::IsValidIndex(
    int Index
    )
{
    return (Index >= 0 && Index < _countof(m_Messages));
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::ControlWindowProc

    Handle messages
------------------------------------------------------------------------------*/
LRESULT
StatusHeaderImpl_t::ControlWindowProc(
    UINT Message,
    WPARAM wParam,
    LPARAM lParam,
    bool& Handled
    )
{
    LRESULT Result;

    //by default assume we handled the message
    Handled = true;

    switch (Message)
    {
    case WM_ERASEBKGND:
        //Fake erasing the background since we paint the whole client area
        return 1;

    case WM_PAINT:
        return OnPaint(reinterpret_cast<HDC>(wParam));

    case WM_STATUSHEADER_ADDSTATUSNOTIFICATION:
        return OnAddNotification(reinterpret_cast<STATUS_HEADER_PARAMETERS*>(lParam), wParam);

    case WM_STATUSHEADER_GETSTATUSCOOKIE:
        return OnGetCookie();

    case WM_STATUSHEADER_REMOVESTATUSNOTIFICATION:
        return OnRemoveNotification(static_cast<DWORD>(wParam));

    case WM_TIMER:
        return OnTimer(wParam, reinterpret_cast<TIMERPROC*>(lParam));

    case WM_CLOSE:
        Handled = ForwardMessageToParent(Message, wParam, lParam, &Result);
        return Result;

    default:
        Handled = false;
        return 0;
    }
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::OnDrawItem

    WM_PAINT handler for the button.  Draws it.
------------------------------------------------------------------------------*/
LRESULT
StatusHeaderImpl_t::OnPaint(
    HDC hdc
    )
{
    HRESULT hr;
    WCHAR TextBuffer[MAX_PATH] = L"";
    PaintHelper_t paint;

    //start the painting operation
    hr = paint.Begin(m_hwnd);
    if (FAILED(hr))
    {
        return 0;
    }

    RECT ClientRect;
    GetClientRect(m_hwnd, &ClientRect);

    if (!m_Background)
    {
        if (FAILED(m_Background.LoadBitmap(
            GlobalData_t::s_ModuleInstance,
            IDB_STATUS
            )))
        {
            return 0;
        }
    }

    //Draw the background
    hr = paint.TileBlt(
        &m_Background,
        &ClientRect,
        NULL,
        Layout_t::StatusHeaderTileLeft(),
        Layout_t::StatusHeaderTileTop(),
        Layout_t::StatusHeaderTileRight(),
        Layout_t::StatusHeaderTileBottom(),
        CLR_INVALID
        );
    ASSERT(SUCCEEDED(hr));

    //If there is a string to display, then draw it
    if (GetWindowText(m_hwnd, TextBuffer, _countof(TextBuffer)) > 0)
    {
        paint.SetBkMode(TRANSPARENT);
        paint.SetFont(Fonts_t::StandardText());
        paint.SetTextColor(Colors_t::DefaultTextColor());

        InflateRect(
            &ClientRect,
            -Layout_t::StatusHeaderTextMargin(),
            0
            );

        paint.DrawText(
            TextBuffer,
            -1,
            &ClientRect,
            DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX | DT_END_ELLIPSIS
            );
    }

    ASSERT(SUCCEEDED(hr));

    paint.End();
    return 0;
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::OnTimer

    Updates the notify button based on the current time.
------------------------------------------------------------------------------*/
LRESULT
StatusHeaderImpl_t::OnTimer(
    UINT TimerId,
    TIMERPROC* pTimerProc
    )
{
    StatusHeaderMessage_t* pmCurrent = NULL;

    //If there is no active message to display, ignore the timer event
    if (!IsValidIndex(m_IndexActiveMessage))
    {
        ASSERT(m_IndexActiveMessage == -1);
        return 0;
    }

    //Update the tick count for the Active Message
    pmCurrent = &m_Messages[m_IndexActiveMessage];
    if (pmCurrent->m_CurrentTick == INFINITE)
    {
        return 0;
    }

    pmCurrent->m_CurrentTick++;

    //If necessary, remove that item
    if (pmCurrent->m_CurrentTick > pmCurrent->m_TimeoutTick)
    {
        OnRemoveNotification(pmCurrent->m_Cookie);
    }

    return 0;
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::AddNotification

    Adds a notification to the button. This notification may not be displayed
    immediately if its priority is not high enough

    Parameters:
        pParameters: A STATUS_HEADER_PARAMETERS or STATUS_HEADER_PARAMETERS_EX structure
        SizeInBytes: size of the structure pointed by pParameters
------------------------------------------------------------------------------*/
HRESULT
StatusHeaderImpl_t::OnAddNotification(
    STATUS_HEADER_PARAMETERS* pParameters,
    UINT SizeInBytes
    )
{
    HRESULT hr = S_OK;
    DWORD TimeoutTick = INFINITE;

    StatusHeaderMessage_t* pnbmCurrent = NULL;
    const WCHAR* pDisplay  = NULL;
    int cchToAllocate;
    bool HaveString = false;

    if (pParameters == NULL)
    {
        ASSERT(FALSE);
        return E_POINTER;
    }

    switch (SizeInBytes)
    {
    case sizeof(STATUS_HEADER_PARAMETERS):
        break;

    case sizeof(STATUS_HEADER_PARAMETERS_EX):
        {
            STATUS_HEADER_PARAMETERS_EX* pExtended = reinterpret_cast<STATUS_HEADER_PARAMETERS_EX*>(pParameters);
            pDisplay = pExtended->pwszDisplayString;
            HaveString = true;
        }
        break;

    default:
        ASSERT(FALSE);
        return E_INVALIDARG;
        break;
    }

    if (!HaveString)
    {
        pDisplay = reinterpret_cast<WCHAR*>(LoadString(
            pParameters->Instance,
            pParameters->ResourceId,
            NULL,
            0
            ));
    }

    //validate parameters
    if (pDisplay == NULL)
    {
        ASSERT(FALSE);
        return E_POINTER;
    }

    //The string cannot be empty
    int Length = wcslen(pDisplay);
    if (! Length)
    {
        return E_INVALIDARG;
    }
    
    cchToAllocate = Length + 1;
    if (cchToAllocate <= 1)
    {
        ASSERT(FALSE);
        return E_INVALIDARG;
    }

    //Prorities must fit in the acceptable priority range
    if (!IsValidIndex(pParameters->Priority))
    {
        ASSERT(FALSE);
        return E_INVALIDARG;
    }

    if (SUCCEEDED(hr))
    {
        if (pParameters->secTimeout != INFINITE)
        {
            TimeoutTick = (pParameters->secTimeout*1000 / c_cmsMainTimer);
        }

        //If there is currently a StatusHeaderMessage_t of the same priority
        //the existing message has to be removed
        pnbmCurrent = &m_Messages[pParameters->Priority];
        ClearEntry(pnbmCurrent);

        //Fill in the struct with the new valid parameters
        pnbmCurrent->m_pDisplay = reinterpret_cast<WCHAR*>(TrackAlloc(
            sizeof(WCHAR) * cchToAllocate
            ));
        if (pnbmCurrent->m_pDisplay == NULL)
        {
            hr = E_OUTOFMEMORY;
        }
        else
        {
            StringCchCopyW(
                pnbmCurrent->m_pDisplay,
                cchToAllocate,
                pDisplay
                );
        }
    }

    if (SUCCEEDED(hr))
    {
        //Copy over the rest of the params
        pnbmCurrent->m_IsValid = TRUE;
        pnbmCurrent->m_Cookie = pParameters->Cookie;
        pnbmCurrent->m_Priority = pParameters->Priority;
        pnbmCurrent->m_TimeoutTick = TimeoutTick;

        //Now there is at least 1 message, ensure the active message
        //takes this new one into account
        hr = UpdateActiveMessage();
        ASSERT(hr == S_OK);
    }

    return hr;
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::OnRemoveNotification

    Message Handler that removes a notification by cookie

    Params: WPARAM - DWORD cookie val of the notification to remove
------------------------------------------------------------------------------*/
LRESULT
StatusHeaderImpl_t::OnRemoveNotification(
    DWORD Cookie
    )
{
    LRESULT Result = 1;
    int Index = 0;

    //Find the first valid message with the matching cookie
    for (Index = 0; Index < _countof(m_Messages); Index++)
    {
        StatusHeaderMessage_t* pnbmCurrent = &m_Messages[Index];

        if (pnbmCurrent->m_IsValid && pnbmCurrent->m_Cookie == Cookie)
        {
            ClearEntry(pnbmCurrent);
            break;
        }
    }

    //If the item was found and removed, we need to update the index of the
    //active message
    if (IsValidIndex(Index))
    {
        Result = UpdateActiveMessage();
    }

    return Result;
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::OnGetCookie

    Gets the cookie of the currently active notification
------------------------------------------------------------------------------*/
LRESULT
StatusHeaderImpl_t::OnGetCookie(
    void
    )
{
    if (m_IndexActiveMessage != -1)
    {
        return m_Messages[m_IndexActiveMessage].m_Cookie;
    }

    return (LRESULT)(DWORD)-1;
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::UpdateActiveMessage

    Figure out which message is currently active
------------------------------------------------------------------------------*/
LRESULT
StatusHeaderImpl_t::UpdateActiveMessage(
    )
{
    int Index = 0;
    int IndexOld = m_IndexActiveMessage;
    bool Invalidate = false;

    //Reset the active message index
    m_IndexActiveMessage = -1;

    //Search for the first valid message, since the array
    //is layed out in order of priority
    for (Index = 0; Index < _countof(m_Messages); Index++)
    {
        if (m_Messages[Index].m_IsValid)
        {
            m_IndexActiveMessage = Index;
            break;
        }
    }

    // Update the window text
    if(m_IndexActiveMessage != -1)
    {
        WCHAR TextBuffer[MAX_PATH];

        // Get the current window text
        GetWindowText(m_hwnd, TextBuffer, _countof(TextBuffer));

        // Compare the strings, then the linkage.  If nothing has changed, we don't need to
        // update.
        if(wcscmp(TextBuffer, m_Messages[m_IndexActiveMessage].m_pDisplay))
        {
            Invalidate = true;
            SetWindowText(m_hwnd, m_Messages[m_IndexActiveMessage].m_pDisplay);
        }
    }
    else
    {
        Invalidate = true;
        SetWindowText(m_hwnd, L"");
    }

    if (Invalidate)
    {
        //Redraw the notify button
        InvalidateRect(m_hwnd, NULL, TRUE);
    }

    //if a valid message was not found, the index will remain at -1
    return IsValidIndex(Index) ? 0 : 1;
}

/*------------------------------------------------------------------------------
    StatusHeaderImpl_t::ClearEntry

    Frees the allocated members of the specified notify message
------------------------------------------------------------------------------*/
void
StatusHeaderImpl_t::ClearEntry(
    StatusHeaderMessage_t* pnbmCurrent
    )
{
    if (!pnbmCurrent)
    {
        ASSERT(0);
        return;
    }

    //The pDisplay member was allocated using TrackAlloc
    if (pnbmCurrent->m_pDisplay != NULL)
    {
        TrackFree(pnbmCurrent->m_pDisplay);
    }

    //Clear out the entire struct
    ZeroMemory(pnbmCurrent, sizeof(StatusHeaderMessage_t));
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国毛片一区二区三区| 91在线国产观看| 91小视频免费看| 制服视频三区第一页精品| 欧美激情一区不卡| 另类的小说在线视频另类成人小视频在线 | 久久久久久电影| 天堂久久一区二区三区| 色哟哟日韩精品| 中国色在线观看另类| 麻豆精品视频在线观看| 欧美日韩综合不卡| 亚洲精品乱码久久久久久| 国产成人精品免费视频网站| 日韩一区二区免费在线观看| 亚洲国产日韩在线一区模特 | 国产精品丝袜91| 国产精品一区二区三区99| 日韩一区二区免费电影| 亚洲成年人影院| 欧美写真视频网站| 亚洲蜜桃精久久久久久久| 成人av影院在线| 国产精品久久久久三级| 成人av网站在线观看免费| 久久久久久久久久久久久夜| 久草精品在线观看| 日韩亚洲欧美在线| 极品少妇xxxx精品少妇| 日韩一区二区三区视频在线观看| 日韩电影在线一区| 555www色欧美视频| 蜜桃av一区二区三区| 在线电影院国产精品| 日韩成人免费看| 欧美成人一级视频| 色综合久久久久网| 亚洲欧美国产三级| 欧美亚洲图片小说| 午夜精品久久久久久久| 欧美三级日韩三级| 免费在线看成人av| 久久青草欧美一区二区三区| 国产精品系列在线观看| 国产精品女主播av| 在线视频综合导航| 免费成人在线观看| 久久久99精品久久| 色综合婷婷久久| 爽爽淫人综合网网站| 日韩欧美高清在线| 成人性生交大片免费看视频在线 | 欧美在线观看视频一区二区| 亚洲一区二区三区爽爽爽爽爽 | 日本视频在线一区| 久久蜜臀中文字幕| 99精品热视频| 日韩在线一区二区三区| 久久女同互慰一区二区三区| 99久久婷婷国产综合精品| 亚洲国产精品自拍| 久久久久国产一区二区三区四区 | 国产成人精品亚洲日本在线桃色| 中文字幕一区二区三区四区不卡| 色久优优欧美色久优优| 久久av中文字幕片| 亚洲综合激情网| 久久日韩粉嫩一区二区三区| 91极品视觉盛宴| 国产在线一区观看| 亚洲午夜久久久久中文字幕久| 日韩欧美在线一区二区三区| a级精品国产片在线观看| 日韩精品久久久久久| 国产日韩欧美精品一区| 欧美区在线观看| 成人av电影在线观看| 另类调教123区| 亚洲成av人影院在线观看网| 国产清纯白嫩初高生在线观看91| 欧美久久久久久蜜桃| 99久久婷婷国产综合精品 | 亚洲成a人片在线不卡一二三区| ww久久中文字幕| 欧美区视频在线观看| 9i在线看片成人免费| 久久99日本精品| 亚洲高清不卡在线观看| 国产精品美女久久久久久久| 精品久久久久久无| 欧美在线观看禁18| av高清不卡在线| 成人毛片老司机大片| 久久国产三级精品| 奇米在线7777在线精品| 亚洲成人精品影院| 日韩一区有码在线| 中文欧美字幕免费| 国产精品少妇自拍| 久久久一区二区三区| 精品女同一区二区| 日韩无一区二区| 欧美一区二区三区不卡| 欧美久久一二三四区| 欧美日韩国产经典色站一区二区三区| 92国产精品观看| av成人老司机| 91视频在线看| 99re这里只有精品6| 91影院在线观看| 欧美在线|欧美| 欧美中文字幕久久| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 国产精品乱码一区二区三区软件 | 欧美日韩国产色站一区二区三区| 91色综合久久久久婷婷| 99精品一区二区三区| 91麻豆福利精品推荐| 成人h动漫精品| 色综合色狠狠天天综合色| 91免费观看国产| 欧美午夜视频网站| 在线播放91灌醉迷j高跟美女 | 秋霞午夜鲁丝一区二区老狼| 日韩国产在线一| 狠狠色综合色综合网络| 99久久久免费精品国产一区二区| 国产成人8x视频一区二区| 国产成人精品免费一区二区| 成人免费毛片片v| 成人av电影在线观看| 在线一区二区三区四区五区| 在线观看国产91| 91精品国产一区二区三区| 日韩一区二区免费视频| 国产欧美日韩视频在线观看| 国产精品久久久一区麻豆最新章节| 中文字幕欧美一| 国产一区视频导航| 成人免费电影视频| 欧美午夜精品久久久久久超碰| 7799精品视频| 亚洲国产成人一区二区三区| 亚洲色图制服丝袜| 奇米影视一区二区三区小说| 国产高清在线精品| 欧美性大战xxxxx久久久| 日韩一区二区电影在线| 国产精品免费av| 三级不卡在线观看| av不卡一区二区三区| 欧美猛男超大videosgay| 2021国产精品久久精品| 亚洲精品国产第一综合99久久| 免费在线一区观看| 色屁屁一区二区| 久久综合久久综合久久综合| 亚洲精品免费在线播放| 美女视频免费一区| 99精品国产热久久91蜜凸| 日韩欧美精品在线视频| 一区二区三区视频在线看| 国内外成人在线| 欧美三级在线播放| 国产精品嫩草99a| 久久99久久精品| 欧美美女一区二区在线观看| 国产精品麻豆久久久| 精一区二区三区| 欧美丝袜丝交足nylons| 中文字幕日韩欧美一区二区三区| 男人操女人的视频在线观看欧美| 91亚洲精华国产精华精华液| 久久奇米777| 青青国产91久久久久久| 91久久精品网| **性色生活片久久毛片| 国产福利91精品| 久久理论电影网| 国产成人高清在线| 日韩视频国产视频| 亚洲一区二区三区四区在线免费观看| 成人激情校园春色| 久久这里都是精品| 韩国v欧美v日本v亚洲v| 日韩欧美中文字幕精品| 亚洲一二三四久久| 色综合欧美在线视频区| 最新国产精品久久精品| 丁香婷婷深情五月亚洲| 国产人久久人人人人爽| 国产在线精品一区二区| 日韩欧美国产三级| 蜜桃av一区二区在线观看| 日韩一区二区三| 久久99精品久久久| 久久精品夜色噜噜亚洲aⅴ| 国产一区二区日韩精品| 2020日本不卡一区二区视频| 国产一区二区三区电影在线观看|