microsoft/Windows-classic-samples

Exception thrown: read access violation in ListViewSample

Opened this issue · 0 comments

Windows-classic-samples/tree/main/Samples/Win7Samples/multimedia/Direct2D)/ListViewSample/


Exception thrown: read access violation.
this was 0x9B6800B0.


HRESULT ListViewApp::CreateDeviceResources()
{
HRESULT hr = S_OK;

if (!m_pRT)                 <<<-------------------------------------------------  Exception at this line in Visual Studio 2015/2019
{
    RECT rc;
    GetClientRect(m_d2dHwnd, &rc);

    D2D1_SIZE_U size = D2D1::SizeU(
        rc.right - rc.left,
        rc.bottom - rc.top
        );

    //create a D2D render target
    hr = m_pD2DFactory->CreateHwndRenderTarget(
        D2D1::RenderTargetProperties(),
        D2D1::HwndRenderTargetProperties(m_d2dHwnd, size),
        &m_pRT
        );
    if (SUCCEEDED(hr))
    {
        //create a black brush
        hr = m_pRT->CreateSolidColorBrush(
            D2D1::ColorF(D2D1::ColorF::Black),
            &m_pBlackBrush
            );
    }
    if (SUCCEEDED(hr))
    {
        hr = m_pRT->CreateBitmap(
            D2D1::SizeU(msc_atlasWidth, msc_atlasHeight),
            D2D1::BitmapProperties(D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)),
            &m_pBitmapAtlas
            );
    }
    if (SUCCEEDED(hr))
    {
        hr = CreateBindCtx(0, &m_pBindContext);
    }
    if (SUCCEEDED(hr))
    {
        hr = LoadDirectory();
    }
}

return hr;

}


'ListViewSample.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.17763.2686_none_de755d285347a0fe\comctl32.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'ListViewSample.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'ListViewSample.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'ListViewSample.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
Exception thrown: read access violation.
this was 0x9B6800B0.