Jump to content
  • Advertisement
Sign in to follow this  
Anddos

IDirect3DSurface9::GetDC()

This topic is 3609 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 win32 GDI buttons on my directx device and having crash problems with getting the hdc HDC hdc; Surface9->GetDC(&hdc); << crash here , this param is HDC *hdc does anyone know the problem , its driving me crazy

Share this post


Link to post
Share on other sites
Advertisement
If that line crashes, then Surface9 is null or invalid. Anything from the Debug Runtimes? Do you check the return values for all D3D functions, particularly the one that you got that pointer from?

Share this post


Link to post
Share on other sites
You can't get the dc from something that doesn't exist ;)
This method allows you to create the surface:

IDirect3DDevice9::CreateOffscreenPlainSurface
HRESULT CreateOffscreenPlainSurface(
UINT Width,
UINT Height,
D3DFORMAT Format,
D3DPOOL Pool,
IDirect3DSurface9** ppSurface,
HANDLE* pSharedHandle
);

Example (found it on google):
m_pDevice->CreateOffscreenPlainSurface(640, 480, D3DFMT_R5G6B5,D3DPOOL_SYSTEMMEM, &pSurface,NULL);

Hope it helps

Cheers

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!