Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access violation with BindDC

15 views
Skip to first unread message

docschnipp

unread,
Nov 2, 2009, 5:53:01 PM11/2/09
to

Hi,

I am trying to keep my DCRenderTarget and on WM_PAINT, I am trying to reuse
it by just calling BindDC.

This works fine the first time, when I just created the render target.

Calling Sequence is:

if (!mTarget)
{
mFactory->CreateDCRenderTarget(...,mTarget);
}
mTarget->BindDC(dc,rect);
mTarget->BeginDraw();
....
// now comes stuff like loading bitmaps and drawing...
....
mTarget->EndDraw(); // D2D_RECREATE_TARGET is handled, too

the next time, WM_PAINT calls this sequence, BindDC fails with an Access
Violation:

First-chance exception at 0xfeeefeee in graphics.exe: 0xC0000005: Access
violation.

What am I missing? Is there something more I need to do to be able to reuse
a target?

Thanks
doc

docschnipp

unread,
Nov 3, 2009, 3:43:01 PM11/3/09
to
"docschnipp" wrote:

> Hi,


>
> First-chance exception at 0xfeeefeee in graphics.exe: 0xC0000005: Access
> violation.
>

I think I know what the problem is: I ->Release()'d an object (a brush) that
was tied to the Target. I thought, by calling "Release()" it would also get
away from the Target, but obviously it is not.

Is there a way to remove an object like a brush or a bitmap from a
RenderTarget?
Or must I keep them all in it?

thanks
doc

0 new messages