Skip to main content
gamedev.net
🔒 Locked

SetCooperativeLevel()

Started by elfin 3 replies 350+ views
Original Post
elfin
elfin
I am trying to set my cooperative level for directX. It keeps failing.Here is part of my code. HRESULT ddrval; ddrval=lpdd->SetCooperativeLevel(MWH,DDSCL_EXCLUSIVE / DDSCL_FULLSCREEN / DDSCL_ALLOWREBOOT); if(ddrval!=DD_OK) { GameState=GSSHUTDOWN; } When I run the program it errors out with exclusive and fullscreen. However when I put it to normal it is fine. Any ideas on why this is happening?
Don Bishop
Don Bishop
Whats the return value your getting?
VyvyanBasterd
VyvyanBasterd
Are you using the ''OR'' character (''/'') or the DIVIDE character (''/'')?

Vyvyan
elfin
elfin
You know. I may be the biggest computer bug there ever was. I will explain what I did. For in the likeliness that others will do the same as I.
#define GSINIT 0 //Game state values
#define GSMENU 1
#define GSRUNNING 2
#define GSSHUTDOWN 3

GameState=0; //sets the game state to init

switch(GameState)
{
case GSINIT:
{
if(DirectDrawCreateEx(NULL,
(VOID**)&lpdd,IID_IDirectDraw7,NULL)!=DD_OK)
{
GameState=GSSHUTDOWN;
}
if(lpdd->SetCooperativeLevel(main_window_handle,DDSCL_FULLSCREEN / DDSCL_EXCLUSIVE / DDSCL_ALLOWREBOOT)!=DD_OK)
{
GameState=GSSHUTDOWN;
}
if(lpdd->SetDisplayMode(800,600,8,0,0)!=DD_OK)
{
GameState=GSSHUTDOWN;
}
} //Notice I didn''t set GameState to GSRUNNING?
It looped around and tried to setup DDRAW and failed cause it was setup already.
I think I win the award for stupid mistakes.
Hway
Hway
And what do learn from this?

No, "do some debugging before you post" is not the right answer here.

As usual, we learn NOTHING!

Yeah, I''m complaining...
~~~ "'impossible' is a word in the dictonary of fools" --Napoleon

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.