DirectDraw GetDC Bug from hell?

Started by
3 comments, last by GameDev.net 24 years, 7 months ago
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!

------------------------
E.N.D. - http://listen.to/evil
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

__________________________________________

Yeah, sure... we are laughing WITH you ...
And better check for errors with the FAILED() or SUCCEEDED() macros.

CU

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

Graphix Coding @Skullpture Entertainmenthttp://www.skullpture.de
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.

Your pseudo-code also looks like it will try to release an HDC if it is NULL. This can be bad news.

This topic is closed to new replies.

Advertisement