Jump to content
  • Advertisement

Archived

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

elfin

SetCooperativeLevel()

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!