当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTDRAWSURFACE7::QueryInterface方法代码示例

本文整理汇总了C++中LPDIRECTDRAWSURFACE7::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE7::QueryInterface方法的具体用法?C++ LPDIRECTDRAWSURFACE7::QueryInterface怎么用?C++ LPDIRECTDRAWSURFACE7::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTDRAWSURFACE7的用法示例。


在下文中一共展示了LPDIRECTDRAWSURFACE7::QueryInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getFrontSurface

// set frontSurface to lpDDSurface if lpDDSurface is primary
// returns true if frontSurface is set
// returns false if frontSurface is NULL and lpDDSurface is not primary
bool getFrontSurface(LPDIRECTDRAWSURFACE7 lpDDSurface)
{
    //logOutput << CurrentTimeString() << "called getFrontSurface" << endl;

    if (!lpDDSurface)
    {
        //logOutput << CurrentTimeString() << "lpDDSurface null" << endl;
        return false;
    }

    if (!g_ddInterface)
    {
        LPDIRECTDRAWSURFACE7 dummy;
        if (lpDDSurface->QueryInterface(IID_IDirectDrawSurface7, (LPVOID*)&dummy) == S_OK)
        {
            IUnknown* Unknown;
            HRESULT err;
            if (FAILED(err = dummy->GetDDInterface((LPVOID*)&Unknown)))
            {
                logOutput << CurrentTimeString() << "getFrontSurface: could not get DirectDraw interface" << endl;
                printDDrawError(err, "getFrontSurface");
            }
            else
            {
                if (Unknown->QueryInterface(IID_IDirectDraw7, (LPVOID*)&g_ddInterface) == S_OK)
                {
                    logOutput << CurrentTimeString() << "Got DirectDraw interface pointer" << endl;
                }
                else
                {
                    logOutput << CurrentTimeString() << "Query of DirectDraw interface failed" << endl;
                }
            }
            ddrawSurfaceRelease.Unhook();
            dummy->Release();
            ddrawSurfaceRelease.Rehook();
        }
    }

    if (!bTargetAcquired)
    {
        DDSCAPS2 caps;
        if (SUCCEEDED(lpDDSurface->GetCaps(&caps)))
        {
            //logOutput << CurrentTimeString() << "checking if surface is primary" << endl;
            if (caps.dwCaps & DDSCAPS_PRIMARYSURFACE)
            {
                logOutput << CurrentTimeString() << "found primary surface" << endl;
                g_frontSurface = lpDDSurface;
                if (!SetupDDraw())
                {
                    return false;
                }
                else
                {
                    bTargetAcquired = true;
                }
            }
        }
        else
        {
            logOutput << CurrentTimeString() << "could not retrieve caps" << endl;
        }
    }

    return lpDDSurface == g_frontSurface;
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:70,代码来源:DDrawCapture.cpp


注:本文中的LPDIRECTDRAWSURFACE7::QueryInterface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。