DirectDraw 7 Setup Problem

Started by
17 comments, last by Bad Maniac 19 years, 6 months ago
When I said screen size I ment the values entered in CreateWindowEx()
=============================All knowledge is good; only the way it is put to use is good or evil.
Advertisement
It has to be something with my moniter, because that code didn't work either. Also, I tried sending the .exe to a friend over MSN and he got the same results - so it might be something I'm doing at compilation. I'm using MSVC++ .NET 2003.
=============================All knowledge is good; only the way it is put to use is good or evil.
Some time ago I had a motherboard with a built-in video card (shared system/video memory) and I wasn't able of getting any of my own fullscreen DirectDraw apps to run on it, I doubt that's the problem in this case though. The solution was to create the backbuffer explicitly with the CreateSurface method (no flipping chain) and use Blt instead of Flip (windowed mode, system memory blt, always works).

If you haven't done it already you may want to try the different display modes (resolution, bit-depht and frequancy) your video card AND monitor supports with the SetDisplayMode method.

I have no experience of VC++ .NET but I had some problems compiling DirectDraw 7 apps under VC++ 6.0 because it always used its older built-in DirectDraw libraries even though I specified the exact path. Now I use Bloodshed Dev-C++ 4.9.9.0 and it compiles without problems. Probably I just had some settings wrong though.
I know for certain that it's the SetCooperativeLevel function by turning the DDSetup() into an int function and having the SetCooperativeLevel() function return the value 2 - and I called a MessageBox() if DDSetup() == 2.
=============================All knowledge is good; only the way it is put to use is good or evil.
I'm surprised noones mentioned this yet. It'll give you a lot more information if you check the error code:
HRESULT hResult;   hResult = lpDD->SetCooperativeLevel(hWnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT);   if(FAILED(hResult))   {      // Log the hResult value      return false;   }

Incidently, you should always use the FAILED() and SUCCEEDED() macros instead of checking for DD_OK.

In the above code, what is the value of hResult? Also, do you have the debug DirectX runtimes installed, with the debug output set to maxiumum? DirectX should give you information in the debug window when a function fails if you're using the debug runtimes.
I know it's the damn SetCooperativeLevel function... I've debugged my ass off and I don't need to be shunned as if I'm an idiot just because I'm not showing every little tiny thing that I try.

(Yes I'm getting frustrated.)
=============================All knowledge is good; only the way it is put to use is good or evil.
Quote:Original post by dist0rted
I know it's the damn SetCooperativeLevel function... I've debugged my ass off and I don't need to be shunned as if I'm an idiot just because I'm not showing every little tiny thing that I try.

(Yes I'm getting frustrated.)


Evil Steve's point was that if you check the return code from the SetCooperativeLevel call, it will tell you exactly why it is failing. Enter the return code into the DirectX Error Lookup tool to get a human translation of the code.
I would strongly suggest that you do what Steve said, but on another note (I am not sure if I am remembering this correctly or not. )

Doesn't a fullscreen window in DX7 need to be overlapped?

CreateWindowEx(NULL, szAppName, szAppName, WS_POPUP|WS_OVERLAPPED (or whatever it is) ...



TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
if(FAILED(IDirectDraw_SetCooperativeLevel(Device,Window_Handle,	DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT))){...}


That's the line I use, Device is the Directdraw device (duuh) and Window_Handle is of course a hwnd to the window. That has worked for me some thousand times.

I't sthe same line You use, so there's no direct problem with the code. You need to log the return code from every call in your DDinit function, and find out what's wrong. There is nothing wrong with your SetCooplevel call, if it fails it's because of something failing before it. check the returns just like the previous posters said.

And no, I just tested with my app, and you don't have to specify WS_OVERLAPPEDWINDOW for it to work.
JRA GameDev Website//Bad Maniac

This topic is closed to new replies.

Advertisement