Advertisement

Always getting DDERR_NOTFOUND

Started by May 22, 2002 01:40 PM
1 comment, last by LordLethis 22 years, 7 months ago
I always get a DDERR_NOTFOUND error when executing the following code...
      
	if (FAILED(DirectDrawCreateEx(0,(void**)&lpDD,IID_IDirectDraw7,0)))
		return 0;
	lpDD->SetCooperativeLevel(hWnd,DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE);
	DDSURFACEDESC2 ddsd;
	ZeroMemory(&ddsd,sizeof(ddsd));
	ddsd.dwSize = sizeof(ddsd);
	ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
	ddsd.dwBackBufferCount = 1;
	ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
	if (FAILED(lpDD->CreateSurface(&ddsd,&lpDDSPrimary,0)))
	{
		lpDD->Release();
		lpDD = 0;
		return 0;
	}
	DDSCAPS2 ddscaps;
	ddscaps.dwCaps = DDSCAPS_BACKBUFFER | DDSCAPS_FLIP;
	HRESULT r = lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack);
    
MSDN says, that means the object was not found. But which object?? And what am I doing wrong?? EDIT: Formatting [edited by - LordLethis on May 22, 2002 2:55:50 PM]
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
The function returning DDERR_NOTFOUND is GetAttachedSuface
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
Advertisement
OK, solved the problem myself...
I just put ZeroMemory(&ddscaps,sizeof(ddscaps)); before setting the ddscaps.
Now it works.
Damn, this took me bout 2 weeks to discover..
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]

This topic is closed to new replies.

Advertisement