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

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

?? winutil.cpp

?? 用DirectX制作高級動畫-[Advanced.Animation.with.DirectX]
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
//------------------------------------------------------------------------------
// File: WinUtil.cpp
//
// Desc: DirectShow base classes - implements generic window handler class.
//
// Copyright (c) 1992-2001 Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------


#include <streams.h>
#include <limits.h>
#include <dvdmedia.h>

static UINT MsgDestroy;

// Constructor

CBaseWindow::CBaseWindow(BOOL bDoGetDC, bool bDoPostToDestroy) :
    m_hInstance(g_hInst),
    m_hwnd(NULL),
    m_hdc(NULL),
    m_bActivated(FALSE),
    m_pClassName(NULL),
    m_ClassStyles(0),
    m_WindowStyles(0),
    m_WindowStylesEx(0),
    m_ShowStageMessage(0),
    m_ShowStageTop(0),
    m_MemoryDC(NULL),
    m_hPalette(NULL),
    m_bBackground(FALSE),
#ifdef DEBUG
    m_bRealizing(FALSE),
#endif
    m_bNoRealize(FALSE),
    m_bDoPostToDestroy(bDoPostToDestroy)
{
    m_bDoGetDC = bDoGetDC;
}


// Prepare a window by spinning off a worker thread to do the creation and
// also poll the message input queue. We leave this to be called by derived
// classes because they might want to override methods like MessageLoop and
// InitialiseWindow, if we do this during construction they'll ALWAYS call
// this base class methods. We make the worker thread create the window so
// it owns it rather than the filter graph thread which is constructing us

HRESULT CBaseWindow::PrepareWindow()
{
    if (m_hwnd) return NOERROR;
    ASSERT(m_hwnd == NULL);
    ASSERT(m_hdc == NULL);

    // Get the derived object's window and class styles

    m_pClassName = GetClassWindowStyles(&m_ClassStyles,
                                        &m_WindowStyles,
                                        &m_WindowStylesEx);
    if (m_pClassName == NULL) {
        return E_FAIL;
    }

    // Register our special private messages
    m_ShowStageMessage = RegisterWindowMessage(SHOWSTAGE);

    // RegisterWindowMessage() returns 0 if an error occurs.
    if (0 == m_ShowStageMessage) {
        return AmGetLastErrorToHResult();
    }

    m_ShowStageTop = RegisterWindowMessage(SHOWSTAGETOP);
    if (0 == m_ShowStageTop) {
        return AmGetLastErrorToHResult();
    }

    m_RealizePalette = RegisterWindowMessage(REALIZEPALETTE);
    if (0 == m_RealizePalette) {
        return AmGetLastErrorToHResult();
    }

    MsgDestroy = RegisterWindowMessage(TEXT("AM_DESTROY"));
    if (0 == MsgDestroy) {
        return AmGetLastErrorToHResult();
    }

    return DoCreateWindow();
}


// Destructor just a placeholder so that we know it becomes virtual
// Derived classes MUST call DoneWithWindow in their destructors so
// that no messages arrive after the derived class constructor ends

#ifdef DEBUG
CBaseWindow::~CBaseWindow()
{
    ASSERT(m_hwnd == NULL);
    ASSERT(m_hdc == NULL);
}
#endif


// We use the sync worker event to have the window destroyed. All we do is
// signal the event and wait on the window thread handle. Trying to send it
// messages causes too many problems, furthermore to be on the safe side we
// just wait on the thread handle while it returns WAIT_TIMEOUT or there is
// a sent message to process on this thread. If the constructor failed to
// create the thread in the first place then the loop will get terminated

HRESULT CBaseWindow::DoneWithWindow()
{
    if (!IsWindow(m_hwnd) || (GetWindowThreadProcessId(m_hwnd, NULL) != GetCurrentThreadId())) {

        if (IsWindow(m_hwnd)) {

            if (m_bDoPostToDestroy) {

                CAMEvent m_evDone;

                //  We must post a message to destroy the window
                //  That way we can't be in the middle of processing a
                //  message posted to our window when we do go away
                //  Sending a message gives less synchronization.
                PostMessage(m_hwnd, MsgDestroy, (WPARAM)(HANDLE)m_evDone, 0);
                WaitDispatchingMessages(m_evDone, INFINITE);
            } else {
                SendMessage(m_hwnd, MsgDestroy, 0, 0);
            }
        }

        //
        // This is not a leak, the window manager automatically free's
        // hdc's that were got via GetDC, which is the case here.
        // We set it to NULL so that we don't get any asserts later.
        //
        m_hdc = NULL;

        //
        // We need to free this DC though because USER32 does not know
        // anything about it.
        //
        if (m_MemoryDC)
        {
            EXECUTE_ASSERT(DeleteDC(m_MemoryDC));
            m_MemoryDC = NULL;
        }

        // Reset the window variables
        m_hwnd = NULL;

        return NOERROR;
    }
    const HWND hwnd = m_hwnd;
    if (hwnd == NULL) {
        return NOERROR;
    }

    InactivateWindow();
    NOTE("Inactivated");

    // Reset the window styles before destruction

    SetWindowLong(hwnd,GWL_STYLE,m_WindowStyles);
    ASSERT(GetParent(hwnd) == NULL);
    NOTE1("Reset window styles %d",m_WindowStyles);

    //  UnintialiseWindow sets m_hwnd to NULL so save a copy
    UninitialiseWindow();
    DbgLog((LOG_TRACE, 2, TEXT("Destroying 0x%8.8X"), hwnd));
    if (!DestroyWindow(hwnd)) {
        DbgLog((LOG_TRACE, 0, TEXT("DestroyWindow %8.8X failed code %d"),
                hwnd, GetLastError()));
        DbgBreak("");
    }

    // Reset our state so we can be prepared again

    m_pClassName = NULL;
    m_ClassStyles = 0;
    m_WindowStyles = 0;
    m_WindowStylesEx = 0;
    m_ShowStageMessage = 0;
    m_ShowStageTop = 0;

    return NOERROR;
}


// Called at the end to put the window in an inactive state. The pending list
// will always have been cleared by this time so event if the worker thread
// gets has been signaled and gets in to render something it will find both
// the state has been changed and that there are no available sample images
// Since we wait on the window thread to complete we don't lock the object

HRESULT CBaseWindow::InactivateWindow()
{
    // Has the window been activated
    if (m_bActivated == FALSE) {
        return S_FALSE;
    }

    m_bActivated = FALSE;
    ShowWindow(m_hwnd,SW_HIDE);
    return NOERROR;
}


HRESULT CBaseWindow::CompleteConnect()
{
    m_bActivated = FALSE;
    return NOERROR;
}

// This displays a normal window. We ask the base window class for default
// sizes which unless overriden will return DEFWIDTH and DEFHEIGHT. We go
// through a couple of extra hoops to get the client area the right size
// as the object specifies which accounts for the AdjustWindowRectEx calls
// We also DWORD align the left and top coordinates of the window here to
// maximise the chance of being able to use DCI/DirectDraw primary surface

HRESULT CBaseWindow::ActivateWindow()
{
    // Has the window been sized and positioned already

    if (m_bActivated == TRUE || GetParent(m_hwnd) != NULL) {

        SetWindowPos(m_hwnd,            // Our window handle
                     HWND_TOP,          // Put it at the top
                     0, 0, 0, 0,        // Leave in current position
                     SWP_NOMOVE |       // Don't change it's place
                     SWP_NOSIZE);       // Change Z-order only

        m_bActivated = TRUE;
        return S_FALSE;
    }

    // Calculate the desired client rectangle

    RECT WindowRect, ClientRect = GetDefaultRect();
    GetWindowRect(m_hwnd,&WindowRect);
    AdjustWindowRectEx(&ClientRect,GetWindowLong(m_hwnd,GWL_STYLE),
                       FALSE,GetWindowLong(m_hwnd,GWL_EXSTYLE));

    // Align left and top edges on DWORD boundaries

    UINT WindowFlags = (SWP_NOACTIVATE | SWP_FRAMECHANGED);
    WindowRect.left -= (WindowRect.left & 3);
    WindowRect.top -= (WindowRect.top & 3);

    SetWindowPos(m_hwnd,                // Window handle
                 HWND_TOP,              // Put it at the top
                 WindowRect.left,       // Align left edge
                 WindowRect.top,        // And also top place
                 WIDTH(&ClientRect),    // Horizontal size
                 HEIGHT(&ClientRect),   // Vertical size
                 WindowFlags);          // Don't show window

    m_bActivated = TRUE;
    return NOERROR;
}


// This can be used to DWORD align the window for maximum performance

HRESULT CBaseWindow::PerformanceAlignWindow()
{
    RECT ClientRect,WindowRect;
    GetWindowRect(m_hwnd,&WindowRect);
    ASSERT(m_bActivated == TRUE);

    // Don't do this if we're owned

    if (GetParent(m_hwnd)) {
        return NOERROR;
    }

    // Align left and top edges on DWORD boundaries

    GetClientRect(m_hwnd, &ClientRect);
    MapWindowPoints(m_hwnd, HWND_DESKTOP, (LPPOINT) &ClientRect, 2);
    WindowRect.left -= (ClientRect.left & 3);
    WindowRect.top  -= (ClientRect.top  & 3);
    UINT WindowFlags = (SWP_NOACTIVATE | SWP_NOSIZE);

    SetWindowPos(m_hwnd,                // Window handle
                 HWND_TOP,              // Put it at the top
                 WindowRect.left,       // Align left edge
                 WindowRect.top,        // And also top place
                 (int) 0,(int) 0,       // Ignore these sizes
                 WindowFlags);          // Don't show window

    return NOERROR;
}


// Install a palette into the base window - we may be called by a different
// thread to the one that owns the window. We have to be careful how we do
// the palette realisation as we could be a different thread to the window
// which would cause an inter thread send message. Therefore we realise the
// palette by sending it a special message but without the window locked

HRESULT CBaseWindow::SetPalette(HPALETTE hPalette)
{
    // We must own the window lock during the change
    {
        CAutoLock cWindowLock(&m_WindowLock);
        CAutoLock cPaletteLock(&m_PaletteLock);
        ASSERT(hPalette);
        m_hPalette = hPalette;
    }
    return SetPalette();
}


HRESULT CBaseWindow::SetPalette()
{
    if (!m_bNoRealize) {
        SendMessage(m_hwnd, m_RealizePalette, 0, 0);
        return S_OK;
    } else {
        // Just select the palette
        ASSERT(m_hdc);
        ASSERT(m_MemoryDC);

        CAutoLock cPaletteLock(&m_PaletteLock);
        SelectPalette(m_hdc,m_hPalette,m_bBackground);
        SelectPalette(m_MemoryDC,m_hPalette,m_bBackground);

        return S_OK;
    }
}


void CBaseWindow::UnsetPalette()
{
    CAutoLock cWindowLock(&m_WindowLock);
    CAutoLock cPaletteLock(&m_PaletteLock);

    // Get a standard VGA colour palette

    HPALETTE hPalette = (HPALETTE) GetStockObject(DEFAULT_PALETTE);
    ASSERT(hPalette);

    SelectPalette(GetWindowHDC(), hPalette, TRUE);
    SelectPalette(GetMemoryHDC(), hPalette, TRUE);

    m_hPalette = NULL;
}


void CBaseWindow::LockPaletteLock()
{
    m_PaletteLock.Lock();
}


void CBaseWindow::UnlockPaletteLock()
{
    m_PaletteLock.Unlock();
}


// Realise our palettes in the window and device contexts

HRESULT CBaseWindow::DoRealisePalette(BOOL bForceBackground)
{
    {
        CAutoLock cPaletteLock(&m_PaletteLock);

        if (m_hPalette == NULL) {
            return NOERROR;
        }

        // Realize the palette on the window thread
        ASSERT(m_hdc);
        ASSERT(m_MemoryDC);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va在线va天堂| 日韩视频中午一区| 国产欧美日本一区二区三区| 日韩福利视频网| 51久久夜色精品国产麻豆| 一区二区日韩av| 欧美性xxxxx极品少妇| 中文字幕亚洲精品在线观看| 黄一区二区三区| 91麻豆精品国产91| 亚洲免费电影在线| 欧美性生交片4| 日韩精品色哟哟| 在线不卡欧美精品一区二区三区| 亚洲男人的天堂在线aⅴ视频| 99re免费视频精品全部| 亚洲精品v日韩精品| 日本久久一区二区| 亚洲风情在线资源站| 在线成人av影院| 精品中文字幕一区二区| 国产女主播在线一区二区| 99re这里只有精品6| 亚洲国产精品一区二区久久恐怖片| 欧美特级限制片免费在线观看| 午夜精品成人在线| 精品久久久久久亚洲综合网 | 中文无字幕一区二区三区| 国产一区二区在线电影| 中文字幕 久热精品 视频在线| 91老师片黄在线观看| 天天影视色香欲综合网老头| 日韩欧美在线影院| 不卡的av中国片| 一区二区久久久| 欧美xxxxx牲另类人与| 成人小视频在线观看| 樱桃视频在线观看一区| 欧美成人r级一区二区三区| 岛国一区二区三区| 亚洲国产精品欧美一二99| www日韩大片| 欧洲亚洲精品在线| 寂寞少妇一区二区三区| 国产日韩精品一区| www.亚洲色图.com| 人禽交欧美网站| 亚洲桃色在线一区| 日韩美女天天操| 色诱亚洲精品久久久久久| 久久99久久99| 亚洲一区二区在线免费看| 久久久一区二区| 欧美日韩亚洲国产综合| 成人一区二区三区中文字幕| 天堂影院一区二区| 中文字幕av一区二区三区免费看| 欧美久久久久久久久久| 91亚洲精华国产精华精华液| 精品亚洲porn| 亚洲成人av免费| 国产精品二区一区二区aⅴ污介绍| 欧美一区二区在线视频| 色婷婷亚洲综合| 丰满白嫩尤物一区二区| 久久99热99| 亚洲欧美在线观看| 久久影院午夜片一区| 欧美四级电影在线观看| 99久久精品免费看| 国产精品一二三四区| 免费人成黄页网站在线一区二区| 亚洲免费视频中文字幕| 欧美激情艳妇裸体舞| 精品88久久久久88久久久| 欧美一区二区三区在线电影| 欧美亚洲日本国产| 91在线精品秘密一区二区| 久久精品国产99国产| 免费人成精品欧美精品| 亚洲一区二区免费视频| 亚洲精品自拍动漫在线| 久久久精品免费免费| 精品美女在线播放| 欧美日韩国产一区| 国产精品一二三区| 国产成人自拍在线| 国产剧情一区在线| 国产·精品毛片| 波多野结衣视频一区| av不卡免费在线观看| av不卡免费电影| 色婷婷亚洲综合| 在线观看免费一区| 在线中文字幕一区二区| 欧美无砖专区一中文字| 欧美三级电影网站| 欧美精品777| 欧美一区二区三区公司| 日韩午夜在线播放| 337p日本欧洲亚洲大胆色噜噜| 日韩亚洲国产中文字幕欧美| 日韩欧美在线网站| 久久婷婷久久一区二区三区| 日本一区二区三区电影| 亚洲欧美在线另类| 亚洲一卡二卡三卡四卡五卡| 首页国产欧美日韩丝袜| 日本成人在线看| 国产精品正在播放| 99精品视频在线免费观看| 欧洲精品在线观看| 91精品婷婷国产综合久久 | 蜜桃久久精品一区二区| 久久99精品久久只有精品| 国产麻豆成人传媒免费观看| 国产成人av一区| 色狠狠色噜噜噜综合网| 91精品欧美综合在线观看最新| 日韩欧美久久久| 国产午夜亚洲精品不卡| 亚洲欧美偷拍三级| 男人的j进女人的j一区| 国产美女在线精品| 91免费版在线| 欧美大片一区二区三区| 国产精品美女一区二区在线观看| 一区二区三区中文在线| 久久精品国产澳门| 色综合久久天天| 日韩一区二区三区电影| 国产精品网站在线| 天堂一区二区在线免费观看| 国产精品一级黄| 欧美美女bb生活片| 国产精品久久久久久久久免费相片| 亚洲自拍与偷拍| 国产一区二区在线观看免费| 欧美性色欧美a在线播放| 精品久久99ma| 亚洲欧洲av另类| 日本午夜一本久久久综合| 丁香婷婷综合网| 欧美一区二区三区四区在线观看| 国产精品日韩成人| 麻豆成人在线观看| 欧美性色综合网| 国产精品久久久久一区二区三区| 亚洲va在线va天堂| 99久久精品国产麻豆演员表| 91精品一区二区三区久久久久久 | 欧美高清视频一二三区| 国产色一区二区| 蜜桃视频一区二区三区| 色8久久人人97超碰香蕉987| 日韩欧美你懂的| 亚洲一区二区三区国产| 成人少妇影院yyyy| 777欧美精品| 亚洲综合免费观看高清在线观看| 国产精品一区二区在线看| 欧美精品九九99久久| 亚洲激情在线激情| 波多野结衣中文字幕一区二区三区| 欧美sm美女调教| 日韩成人精品视频| 欧美日韩aaa| 亚洲成人激情综合网| 日本韩国欧美国产| 国产精品女上位| 丰满白嫩尤物一区二区| 久久久99久久| 国产精品一品二品| 久久久久国产精品麻豆ai换脸| 蓝色福利精品导航| 日韩精品一区二区三区swag| 日韩成人免费在线| 91麻豆精品国产91| 免播放器亚洲一区| 日韩视频免费观看高清在线视频| 亚洲a一区二区| 欧美另类久久久品| 日韩va亚洲va欧美va久久| 制服.丝袜.亚洲.另类.中文| 五月激情综合网| 欧美日韩成人一区| 久久欧美中文字幕| 国产精品12区| 亚洲美女电影在线| 在线91免费看| 国产精品一区二区久久不卡| 1区2区3区精品视频| 欧美美女视频在线观看| 国产一区二区电影| 亚洲天堂中文字幕| 69堂精品视频| 国产精品亚洲一区二区三区妖精| 最新日韩av在线| 欧美日本精品一区二区三区| 国产老女人精品毛片久久|