Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


DirectDraw GetDC Bug from hell?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 17 September 1999 - 08:08 AM

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.


Sponsor:

#2 Evil   Members   -  Reputation: 122

Like
Likes
Like

Posted 14 September 1999 - 06:49 AM

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!


#3 mordell   Members   -  Reputation: 122

Like
Likes
Like

Posted 14 September 1999 - 07:48 AM

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


#4 NuFAN   Members   -  Reputation: 122

Like
Likes
Like

Posted 15 September 1999 - 12:14 PM

And better check for errors with the FAILED() or SUCCEEDED() macros.

CU

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


#5 Sphet   Members   -  Reputation: 631

Like
Likes
Like

Posted 17 September 1999 - 08:08 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS