• Advertisement

Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

DirectDraw GetDC Bug from hell?

This topic is 6698 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've used GetDC many times, and never had problems. You seem to be using it properly.

If I was going to start debugging, I would start with lpdds. Chances are that it is not pointing to a valid surface when you're experiencing your crashes.

Good Luck!

Share this post


Link to post
Share on other sites
Advertisement
Stiby,

I noticed that your calling ::ReleaseDC( hdc ) , not IDirectDrawSurface::ReleaseDC( hdc ).

If this isn't a typo, you will need to replace it with the IDirectDrawSurface::ReleaseDC version.

HTH,

-mordell

Share this post


Link to post
Share on other sites
And better check for errors with the FAILED() or SUCCEEDED() macros.

CU

------------------
Skullpture Entertainment
#40842461

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Anyone got IDirectDrawSurface::GetDC() to work properly?

Using GDI and DirectX to get around the problem of Colour space conversion I have had just pain.

One machine I got make DDraw32.dll crash a couple of times and the code works fine and on anouther I get "Invalid DC" passed back, followed by GDI.EXE and Explorer.exe dieing and having to reboot.

Here's an example of what I have coded.

if( lpdds->GetDC( &hdc ) == DD_OK )
{
if( hdc != NULL )
{
cImageClass->CopyToDC( hdc );
}
else
MessageBox( NULL, "Invalid DC", "FATAL ERROR", MB_OK );

ReleaseDC( hdc );
}
else
MessageBox( NULL, "Unable to obtain HDC", "ERROR", MB_OK );

The odd thing is that GetDC returned DD_OK when it fails?

Hope someone can help.

Share this post


Link to post
Share on other sites
Your pseudo-code also looks like it will try to release an HDC if it is NULL. This can be bad news.

Share this post


Link to post
Share on other sites

  • Advertisement