亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
五月天婷婷综合| 久久精品亚洲麻豆av一区二区| 亚洲三级在线播放| 色素色在线综合| 美女在线观看视频一区二区| 欧美一级在线免费| 激情另类小说区图片区视频区| 精品少妇一区二区三区免费观看 | 精品日韩一区二区三区| 国模少妇一区二区三区| 亚洲国产精品成人综合| proumb性欧美在线观看| 亚洲精品欧美激情| 欧美性受xxxx黑人xyx性爽| 亚洲成人av一区二区三区| 欧美岛国在线观看| 成人深夜在线观看| 亚洲午夜精品久久久久久久久| 欧美一区二区黄| 国产福利一区在线观看| 亚洲色图19p| 日韩欧美中文一区二区| 成人性生交大片免费看中文| 一区二区三区国产精品| 日韩欧美国产三级| 色综合久久综合| 久久精品久久99精品久久| 中文久久乱码一区二区| 欧美美女一区二区三区| 丰满白嫩尤物一区二区| 亚洲国产综合色| 国产三级精品视频| 欧美日韩国产综合一区二区| 国产精品18久久久久久vr| 亚洲综合图片区| 久久精品视频网| 欧美日韩国产精品成人| 国产精品一二三四区| 亚洲二区视频在线| 国产精品嫩草影院com| 欧美一卡2卡三卡4卡5免费| 99re66热这里只有精品3直播| 奇米777欧美一区二区| 中文字幕一区二区三中文字幕| 欧美精品丝袜久久久中文字幕| 成人av资源站| 韩国av一区二区三区在线观看| 亚洲免费观看高清完整| 国产色综合一区| 日韩欧美国产电影| 91极品美女在线| 国产91精品免费| 蜜桃一区二区三区在线| 亚洲成人综合视频| 亚洲免费观看高清完整版在线 | 日韩中文字幕区一区有砖一区| 2023国产精品| 欧美一级午夜免费电影| 91久久精品一区二区| 成人激情黄色小说| 91电影在线观看| 成人爽a毛片一区二区免费| 精品在线观看免费| 日韩av中文字幕一区二区三区| 一区二区三区中文字幕| 成人免费一区二区三区在线观看| 精品成人佐山爱一区二区| 91精品国产综合久久精品麻豆| 欧美在线观看你懂的| 色综合一个色综合| 99精品久久免费看蜜臀剧情介绍| 国产风韵犹存在线视精品| 国内成人精品2018免费看| 久久不见久久见免费视频7| 免费视频最近日韩| 老司机精品视频线观看86| 午夜电影久久久| 午夜国产不卡在线观看视频| 亚洲高清免费视频| 三级久久三级久久久| 丝袜国产日韩另类美女| 亚洲v中文字幕| 日日摸夜夜添夜夜添国产精品| 亚洲成a人片在线不卡一二三区| 亚洲一区二区三区国产| 亚洲无人区一区| 亚洲国产精品一区二区久久恐怖片| 亚洲制服丝袜在线| 亚洲成人高清在线| 麻豆视频观看网址久久| 精久久久久久久久久久| 国产精品亚洲一区二区三区妖精 | 国产婷婷精品av在线| 久久久久免费观看| 中文字幕av一区二区三区高 | 欧美成人一级视频| 久久综合久久久久88| 日本一区二区免费在线| 亚洲人123区| 婷婷综合五月天| 国产露脸91国语对白| 成人国产一区二区三区精品| 色综合天天性综合| 正在播放一区二区| 国产日韩欧美精品在线| 亚洲欧美日韩国产另类专区| 亚洲成人自拍偷拍| 国产美女主播视频一区| 91一区二区三区在线播放| 欧美日韩国产免费一区二区| 精品欧美一区二区久久| 国产精品久久久久久久午夜片 | 欧美伊人精品成人久久综合97| 欧美日韩另类国产亚洲欧美一级| 欧美一区日本一区韩国一区| 久久亚洲一区二区三区四区| 国产精品久久久久影院色老大| 婷婷久久综合九色国产成人| 国产一区二区按摩在线观看| 日本道免费精品一区二区三区| 日韩免费电影网站| 自拍偷拍欧美激情| 久久91精品国产91久久小草| 91在线一区二区三区| 精品嫩草影院久久| 亚洲综合丁香婷婷六月香| 激情成人午夜视频| 欧美色涩在线第一页| 欧美极品美女视频| 免费欧美高清视频| 91浏览器打开| 国产亚洲一区二区三区四区 | 奇米影视一区二区三区小说| www.日本不卡| 精品国产一区二区亚洲人成毛片| 亚洲欧美怡红院| 韩国在线一区二区| 91.xcao| 亚洲乱码精品一二三四区日韩在线| 久久精品国产99| 91久久久免费一区二区| 国产欧美日韩综合精品一区二区| 偷拍日韩校园综合在线| 色综合一个色综合| 国产欧美一区二区三区网站 | 欧美一级欧美一级在线播放| 亚洲黄色在线视频| 成年人网站91| 国产日产欧美一区二区三区| 奇米影视7777精品一区二区| 欧美色爱综合网| 亚洲摸摸操操av| 波多野结衣一区二区三区| 337p日本欧洲亚洲大胆精品| 日韩主播视频在线| 欧美日韩另类一区| 亚洲一区二区精品3399| 91精品办公室少妇高潮对白| 国产精品卡一卡二卡三| 国产精品66部| 久久久久久**毛片大全| 九九久久精品视频 | 日韩精品专区在线| 免费成人av在线| 欧美一区二区在线观看| 日本中文字幕不卡| 69堂亚洲精品首页| 日本91福利区| 日韩欧美一二三四区| 日韩中文字幕一区二区三区| 欧美视频一区二区| 性做久久久久久| 日韩一级片网址| 老司机午夜精品99久久| 精品国产一区二区亚洲人成毛片| 久久精品国产成人一区二区三区| 日韩一区二区三区电影在线观看| 蜜桃在线一区二区三区| 欧美大度的电影原声| 国产一区二区三区日韩| 国产亚洲欧美日韩俺去了| 国产·精品毛片| 亚洲女与黑人做爰| 欧美日韩另类国产亚洲欧美一级| 亚洲成人激情自拍| 日韩美一区二区三区| 国产一二精品视频| 中文字幕一区二区三区在线不卡 | 精品少妇一区二区三区| 国产成人aaaa| 亚洲乱码日产精品bd| 欧美另类z0zxhd电影| 精油按摩中文字幕久久| 国产精品久久久久久久久动漫| 91麻豆6部合集magnet| 日本三级韩国三级欧美三级| 亚洲精品一区二区三区精华液| 成人网男人的天堂| 午夜精品成人在线视频| 欧美成人猛片aaaaaaa|