Advertisement

DDRAWSurface->GetDC

Started by June 21, 2002 01:39 PM
4 comments, last by LordLethis 22 years, 4 months ago
Everytime I try 2 get the surfaces device context, my app crashes, the only thing working anymore are Winamp, the reset- and the powerbutton... Here s the code:
  
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.dwWidth = 44;
ddsd.dwHeight = 27;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
if (FAILED(lpDD->CreateSurface(&ddsd,&lpDDSSht,0)))
	return 0;
HDC hDC,hMemDC;
lpDDSSht->GetDC(&hDC);
  
I don''t get it... Help me someone, please..
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
plz, someone...

Those who do not love don''t live.
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
Advertisement
Strange... I''m having the same problem right now too... maybe it''s a conspiracy Seriously though, I''d be interested to hear if anyone has any suggestions, too.
Peon
All you guys out there, no ideas??

Peon: If you can solve the problem and get your code working, write how you did. I''ll do the same if I can

Those who do not love don''t live.
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
Now I have a harder problem:
Everytime I wanna start a DirectX using prog, I get a messagebox:

Could not start DDRAW.DLL.
Check the filename.

I removed DX with DirectX Buster and reinstalled it, but that didn't work. Anything I can do (except

format C:
G:
setup
)
and wait 30min for Windows to be Installed completely and have another 24hours to reinstall all progs...

But solutions to my problem are still welcome...

Those who do not love don't live.

[edited by - LordLethis on June 24, 2002 10:45:37 AM]
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
Okay, well, in response to your first question...

I solved my problem, but I don''t think its the same as yours. For me, I was trying to to have my CDDrawObject class send a pointer to a surface to another function, which it turn would attempt to acquire an HDC using that surface.

I couldn''t get that to work, so I moved the drawText() function into the CDDrawObject itself (where it should probably go, anyway) and then I acquired an HDC that way and I saw "test" appear on the screen.

So I''m really not sure what''s happening to you. It doesn''t look like you were trying to from the code, but make sure your surface isn''t locked; I don''t think you can acquire an HDC if it is.

Hope you figure it out
Peon

This topic is closed to new replies.

Advertisement