I am working on DirectDraw code to implement page flipping:
In my code lpDD->CreateSurface fails with DDERR_NOEXCLUSIVEMODE after a
successful call of lpDD->SetCooperativeLevel (hwnd,
DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN).
The sequence goes like this:
// my DD_Assert macro prints the error code (if != DD_OK) into a file
LPDIRECTDRAW lpDD = CreateDirectDraw (0,0,0);
DD_Assert (lpDD->SetCooperativeLevel (hwnd,
DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN));
DD_Assert (lpDD->SetDisplayMode (640, 480, 8));
// at this point the screen switches visibly
DDSURFACEDESC desc;
desc.dwSize = sizeof (desc);
if (numBackBuffers) {
desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
desc.dwBackBufferCount = numBackBuffers;
desc.ddsCaps.dwCaps =
DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX;
} else {
desc.dwFlags = DDSD_CAPS;
desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
}
LPDIRECTDRAWSURFACE lpSurface;
DD_Assert (lpDD->CreateSurface (desc, &lpSurface, 0));
The last DD_Assert prints out the error code DDERR_NOEXCLUSIVEMODE.
This only happens:
- on Windows 95
- if the screen resolution is != 8 bits originally (ie. it happens in
800*600*16, but not in 800*600*8)
It doesn't happen on NT, no matter what the current display mode is (ie.
16 or 8 bits doesn't matter).
Any ideas any one? Helpful remarks?
I'd be really happy if you could email the answer as well as posting it.
Harald Niesche
Harald Niesche <h...@mind.de> wrote in article <3324AB...@mind.de>...
>Hi,
>
>I am working on DirectDraw code to implement page flipping:
>
>In my code lpDD->CreateSurface fails with DDERR_NOEXCLUSIVEMODE after a
>successful call of lpDD->SetCooperativeLevel (hwnd,
>DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN).
>
Yep, this happens on some of our machines too.
You set cooperative level to exclusive, and then ask for a full screen
exclusive surface and it fails!
My solution is:-
SetCooperativeLevel(exclusive/fullscreen);
SetDisplayMode();
SetCooperativeLevel(exclusive/fullscreen);
CreateSurface();
That works every time for me! Heaven knows why the second call to
SetCooperativeLevel is needed.
Jim
>
> Harald Niesche <h...@mind.de> wrote in article <3324AB...@mind.de>...
> > Hi,
> >
> > I am working on DirectDraw code to implement page flipping:
> >
> > In my code lpDD->CreateSurface fails with DDERR_NOEXCLUSIVEMODE after a
> > successful call of lpDD->SetCooperativeLevel (hwnd,
> > DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN).
> >