Jump to content
  • Advertisement


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



This topic is 6291 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 am trying to use LPDIRECTDRAWSURFACE7::GetPixelFormat() to retrieve the pixel format for my primary surface, but it doesn''t work. If I simply call the function without initializing my LPDDPIXELFORMAT structure, it will just fail. But the program will stay loaded until I close it. However, if I use memset to set all of it to 0 and the set it''s dwSize variable to: sizeof(lpDDPixel), then the program quits running, exits by itself. What gives? If you need some more info (and, ofcourse, would like to help...) I''m sure I could provide. -Sponge99

Share this post

Link to post
Share on other sites

its a *Long Pointer* (LP) to DDPIXELFORMAT!!

So if you are saying:

memset( ddpf, sizeof(DDPIXELFORMAT), 0 );
ddpf->dwSize = sizeof(DDPIXELFORMAT);
...->GetPixelFormat( ddpf )

Thats wrong, its a pointer which doesn''t point to anywhere, you end up memsetting the pointer and the variables following in memory to 0!!! - You should be saying something like:

memset( &ddpf, sizeof(DDPIXELFORMAT), 0 );
ddpf.dwSize = sizeof(DDPIXELFORMAT);
...->GetPixelFormat( &ddpf )

[Note the &''s and .''s]

Simon O''''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
Is there no way I can do it with LPDDPIXELFORMAT? Cause the app works with DDPIXELFORMAT, but my book tells me to work the long pointer?

Side question (if anyone has the time): What''s the diff between a ptr and a long ptr?

Anyway, is there a way I can convert DDPIXELFORMAT into LPDDPIXELFORMAT? I tried returning DDPIXELFORMAT from my function with:
return &DDPelTemp;

but it gave me a warning: returning address of local variable. Horrible or OK?

I hope that made sense, cause I need some help!


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!