C++ (Cpp) FAILED Examples

C++ (Cpp) FAILED - 30 examples found. These are the top rated real world C++ (Cpp) examples of FAILED extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
//-----------------------------------------------------------------------------
// キーボード用オブジェクト作成
//-----------------------------------------------------------------------------
bool CDirectInput::InitKeybord(HWND hWnd)
{
    HRESULT		hr;

    //キーボード用にデバイスオブジェクトを作成
    hr = m_pDInput->CreateDevice(GUID_SysKeyboard, &m_pDIKeyboard, NULL);
    if ( FAILED(hr) )
        return false;  // デバイスの作成に失敗

    //キーボード用のデータ・フォーマットを設定
    hr = m_pDIKeyboard->SetDataFormat(&c_dfDIKeyboard);
    if ( FAILED(hr) )
        return false; // デバイスの作成に失敗

    //モードを設定(フォアグラウンド&非排他モード)
    hr = m_pDIKeyboard->SetCooperativeLevel(hWnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
    if ( FAILED(hr) )
        return false; // モードの設定に失敗

    //キーボード入力制御開始
    m_pDIKeyboard->Acquire();

    return true;

}
void RendererBase::CreateResource(const DescVertexBuffer & desc, VertexBuffer * resource)
{
    resource->byte_count = desc.ByteCount;
    resource->byte_stride = desc.ByteStride;
    resource->offset = 0;
    resource->usage = desc.Usage;


    D3D10_BUFFER_DESC bd;
    bd.Usage = MappingBufferUsage[desc.Usage];
    bd.ByteWidth = desc.ByteCount;
    bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
    bd.CPUAccessFlags = MappingCPUAccess[desc.Usage];
    bd.MiscFlags = 0;

    if (desc.InitialData)
    {
        D3D10_SUBRESOURCE_DATA subresource_data;
        subresource_data.pSysMem = desc.InitialData;
        subresource_data.SysMemPitch = 0;
        subresource_data.SysMemSlicePitch = 0;
        bool failed = FAILED( pimpl->d3d_device->CreateBuffer(&bd, &subresource_data, (ID3D10Buffer **) &resource->PRIVATE));
    }
    else
    {
        bool failed = FAILED( pimpl->d3d_device->CreateBuffer(&bd, NULL, (ID3D10Buffer **) &resource->PRIVATE));
        CONDITIONAL_EXCEPTION(failed, "VertexBuffer Creation Failed.");
    }
}
Example #3
0
static void BrsFolder_CheckValidSelection( browse_info *info, LPTV_ITEMDATA lptvid )
{
    LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
    LPCITEMIDLIST pidl = lptvid->lpi;
    BOOL bEnabled = TRUE;
    DWORD dwAttributes;
    HRESULT r;

    if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
            !PIDLIsType(pidl, PT_COMP))
        bEnabled = FALSE;
    if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
    {
        dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
        r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
                                         (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
        if (FAILED(r) || !(dwAttributes & (SFGAO_FILESYSANCESTOR|SFGAO_FILESYSTEM)))
            bEnabled = FALSE;
    }
    if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
    {
        dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
        r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1,
                                         (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes);
        if (FAILED(r) ||
                ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM)))
        {
            bEnabled = FALSE;
        }
    }
    SendMessageW(info->hWnd, BFFM_ENABLEOK, 0, bEnabled);
}
int _tmain(int argc, _TCHAR* argv[])
{
    TINYCLR_HEADER();

    CLR_RT_Assembly::InitString();

    CLR_RT_StringVector vec;
    Settings            st;
    LPWSTR              convertFont[] = { L"-convertFont" };

    TINYCLR_CHECK_HRESULT(::CoInitialize( 0 ));

    TINYCLR_CHECK_HRESULT(HAL_Windows::Memory_Resize( 1024 * 1024 ));
    HAL_Init_Custom_Heap();

    CLR_RT_Memory::Reset         ();

    st.PushArguments( 1, convertFont, vec );
    st.PushArguments( argc-1, argv+1, vec );

    TINYCLR_CHECK_HRESULT(st.ProcessOptions( vec ));

    TINYCLR_CLEANUP();

    if(FAILED(hr))
    {
        fflush( stdout );
    }

    ::CoUninitialize();

    return FAILED(hr) ? 10 : 0;
}
Example #5
0
void GetDX10Screenshot(IDXGISwapChain* swapChain, QByteArray& screen) {
    IDXGIResource *backbufferPtr = nullptr;
    swapChain->GetBuffer(0, __uuidof(ID3D10Resource), (void**)&backbufferPtr);
    if (!backbufferPtr) {
        return;
    }

    ID3D10Resource* backbuffer;
    HRESULT hr = backbufferPtr->QueryInterface(__uuidof(ID3D10Resource), (void**)&backbuffer);
    if (FAILED(hr)) {
        return;
    }
    ID3D10Device* device;
    hr = swapChain->GetDevice(__uuidof(ID3D10Device), (void**)&device);
    if (FAILED(hr)) {
        return;
    }

    DXGI_SWAP_CHAIN_DESC desc;
    hr = swapChain->GetDesc(&desc);
    if (FAILED(hr)) {
        return;
    }
    D3D10_TEXTURE2D_DESC textDesc = {};
    textDesc.Format = GetDxgiFormat(desc.BufferDesc.Format);
    textDesc.Width = desc.BufferDesc.Width;
    textDesc.Height = desc.BufferDesc.Height;
    textDesc.MipLevels = 1;
    textDesc.ArraySize = 1;
    textDesc.SampleDesc.Count = 1;
    textDesc.Usage = D3D10_USAGE_STAGING;
    textDesc.CPUAccessFlags = D3D10_CPU_ACCESS_READ;

    ID3D10Texture2D* texture = nullptr;
    hr = device->CreateTexture2D(&textDesc, 0, &texture);
    if (FAILED(hr)) {
        return;
    }

    device->CopyResource(texture, backbuffer);

    D3D10_MAPPED_TEXTURE2D mapText = {0, 0};
    hr = texture->Map(0, D3D10_MAP_READ, 0, &mapText);
    if (FAILED(hr)) {
        return;
    }

    NQtScreen::EImgByteFormat fmt = NQtScreen::BF_R8G8B8A8;
    if (textDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM ||
            textDesc.Format == DXGI_FORMAT_B8G8R8X8_UNORM ||
            textDesc.Format == DXGI_FORMAT_B8G8R8A8_TYPELESS ||
            textDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM_SRGB ||
            textDesc.Format == DXGI_FORMAT_B8G8R8X8_TYPELESS ||
            textDesc.Format == DXGI_FORMAT_B8G8R8X8_UNORM_SRGB)
    {
        fmt = NQtScreen::BF_B8G8R8A8;
    }

    screen = PackImageData(fmt, (char*)mapText.pData, textDesc.Height, textDesc.Width);
}
Example #6
0
//-------------------------------------------------------------
/// Clear the scene and prepare device for retrieving geometry.
//-------------------------------------------------------------
VCNBool VCND3D9::BeginRendering( bool bClearPixel, bool bClearDepth, bool bClearStencil )
{
    // is there anything at all to clear?
    if( bClearPixel || bClearDepth || bClearStencil )
    {
        DWORD flags = 0;

        if( bClearPixel )
            flags |= D3DCLEAR_TARGET;

        if( bClearDepth )
            flags |= D3DCLEAR_ZBUFFER;

        if( bClearStencil )
            flags |= D3DCLEAR_STENCIL;

        if( FAILED(mDevice->Clear(0, NULL, flags, mClearColor, 1.0f, 0)) )
        {
            TRACE(L"VCND3D::BeginRendering - ERROR!");
            return false;
        }
    }

    if( FAILED(mDevice->BeginScene()) )
        return false;

    mIsSceneRunning = true;
    return true;
}