#### Archived

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

# DirectX SetDisplayMode problem

This topic is 6554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Here's the code snippet this is all about:
// base directdraw interface
if(FAILED(DirectDrawCreate(NULL, &g_lpdd, NULL)))
{
return 0;
}

// now version 4 of the interface
if(FAILED(g_lpdd->QueryInterface(IID_IDirectDraw4, (LPVOID *)&g_lpdd4)))
{
return 0;
}

// set the cooperative level
if(FAILED(g_lpdd4->SetCooperativeLevel(g_hwnd, DDSCL_FULLSCREEN / DDSCL_ALLOWMODEX / DDSCL_EXCLUSIVE / DDSCL_ALLOWREBOOT)))
{
return 0;
}

// set display mode
temp = g_lpdd4->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);

Now, SetDisplayMode gives a DDERR_INVALIDPARAMS error. I have these defines: #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 #define SCREEN_BPP 16 I have installed the DX7 SDK, and use Windows 2000 Professional. I'm working with version 4 of the interfaces, because I have LaMothe's book, and it deals with those. I heard this was possible with COM (and none of the other functions have given me problems). I'd really appreciate some help on this. Thanks, /Alexander "SoulReaper" Deruwe Edited by - SoulReaper on 3/13/00 12:02:19 PM

##### Share on other sites
Im not sure if this is true for version 4. Anyways, in V7 the SetDisplayMode takes 5 params as follows.

HRESULT SetDisplayMode(
DWORD dwWidth,
DWORD dwHeight,
DWORD dwBPP,
DWORD dwRefreshRate,
DWORD dwFlags
);

The dwRefreshRate should be 0 (uses the default).
The dwFlags are used only to enter Mode13 so just set these to 0.

Hope this helps

##### Share on other sites
Normally the compiler complains if it doesn''t have all the params for setdisplaymode. Try using DirectDrawCreateEx(), i''m not sure of the parameters, so look it up in the documentation. Another idea is just switching to DirectDraw7 completely, it''d save you headaches in updating your program.

"When people tell you they want to hear the truth, you know that their lying."

##### Share on other sites
Yeah, it would appear that switching to DirectDraw7 is the best way to solve this, so that''s what I''ll do.

Thanks for helping

/Alexander "SoulReaper" Deruwe