Skip to main content
GameDev.net gamedev.net
🔒 Locked

Help me with this problem

Started by Zeraan Jun 12, 2002 at 5:23 PM 11 replies 300+ views
Original Post
Zeraan
Zeraan
I want to make a full screen application, and I declared FULLSCREEN and EXCLUSIVE in cooperation, and then set the resoultion. But what I get is this. Can you tell me why my application isn't going full screen? If you need more details, tell me. Thanks I added error reporting and it said that I failed to set cooperation. Why is it failing? DirectDrawCreateEx(NULL, (LPVOID*)&lpdd, IID_IDirectDraw7, NULL) lpdd->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT) I removed the error checking. ______________________________________________ You know your game is in trouble when your AI says, in a calm, soothing voice, "I'm afraid I can't let you do that, Dave" [edited by - Zeraan on June 12, 2002 6:31:22 PM]
FunkyTune
FunkyTune
It would be easier if we knew the errorcode that setCooperativeLevel() returned.

/John
/John
Zeraan
Zeraan
I know that the DirectDraw returns a HRESULT value, but how can I get the exact error? Do I do like this:

if(error == someError)
output error?

if so, what are the errors that it can return from cooperation?

or is there a function that tells the error?
FunkyTune
FunkyTune
These are the possible error codes (according to the SDK docs):
DDERR_EXCLUSIVEMODEALREADYSET
DDERR_HWNDALREADYSET
DDERR_HWNDSUBCLASSED
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_OUTOFMEMORY

I suggest you test them like you said:
if (result == DDERR_ERRORCODE)
//Do error output

/John

EDIT: Doh, forgot to add edit text.

[edited by - FunkyTune on June 12, 2002 7:09:14 PM]

[edited by - FunkyTune on June 12, 2002 7:10:09 PM]
/John
IndirectX
IndirectX
Use the debug runtime.
---visit #directxdev on afternet <- not just for directx, despite the name
Ravenshadow
Ravenshadow
You''re not giving it a valid window handle.

You need to get the hWnd from the applications window
and pass that to SetCooperativeLevel

--Ravenshadow
Zeraan
Zeraan
Sorry, I''m a newbie to this stuff, but by application window do you mean this function?

ShowWindow(hWnd, nShowCmd);

the game_init is right after ShowWindow.

Or maybe you meant something else?

______________________________________________
You know your game is in trouble when your AI says, in a calm, soothing voice, "I''m afraid I can''t let you do that, Dave"
Ravenshadow
Ravenshadow
If you''re creating the window yourself then the hWnd
you need is the return value of MakeWindow(...)

If you''re using MFC the hWnd you need is a member
of the main CWnd object "this->m_hWnd" for example.

--Ravenshadow
Zeraan
Zeraan
I don''t really understand.

ShowWindow(...); is a windows function that shows the window. For initalization of the window, I use this function:

CreateWindowEx(NULL, "WinClass", "DirectDraw7", WS_POPUP | WS_VISIBLE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL)

I''m not sure what you mean by MFC. I''m a newbie to windows programming. What is MakeWindow(...)? I never heard of that function.

______________________________________________
You know your game is in trouble when your AI says, in a calm, soothing voice, "I''m afraid I can''t let you do that, Dave"
Ravenshadow
Ravenshadow
CreateWindowEx(...) is gonna return the handle to window you
just created. That return value is the value you need to
pass to SetCooperativeLevel(...)

--Ravenshadow
Zeraan
Zeraan
I tried this hWnd = CreateWindowEx(...) and it worked! Thanks so much! Now I can progress onto the drawing stuff

Funny how little things like that can mess up your whole programs.

______________________________________________
You know your game is in trouble when your AI says, in a calm, soothing voice, "I''m afraid I can''t let you do that, Dave"

Topic Locked

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

Sign in to reply to this topic.