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

DirectDrawCreate crashes display

Started by Ilthigore Dec 21, 2002 at 7:19 AM 1 replies 850+ views
Original Post
Ilthigore
Ilthigore
When I try to run a VC++ program calling DirectDrawCreate or DirectDrawCreateEx my monitor light turns yellow (like in power saving mode) and I cannot continue without restarting my PC (a real pain). I bought "Sam's Tricks of the Windows Game Programming Gurus" and compiled the demo source:
      
LPDIRECTDRAW7 lpDD;

int GameInit() //The initialization function in my Win32 wrapper

{
  if(FAILED(DirectDrawCreateEx(NULL, (void**)lpDD, IID_IDirectDraw7, NULL)))
    return 0;

  if(FAILED(lpDD->SetCooperativeLevel(g_hWnd, DDSCL_NORMAL)))
    return 0;

  return 1;
}

int GameRelease() //The shutdown function in my Win32 wrapper

{
  if(lpDD)
  {
    lpDD->Release();
    lpDD=NULL;
  }
  return 1;
}
      
I probably made an error in typing that out but you get the picture. The application doesn't do anything except initialize DirectX (and do everything in the Win32 wrapper which includes WinMain and WndProc if you are wondering where they are. Anyway, when I run my compiled executable, my monitor doesn't turn off, but enters power saving mode (or something similar to that). The computer is still working normally (including sound, input, etc.) but the monitor does not work, even when I turn it off and on. In the end I just press Ctrl-Alt-Del (my three most frequently used keys probably) twice to restart and then the display comes back with all the BIOS stuff. Also I know that the problem is NOT caused after the call to DirectDrawCreateEx() because I tried putting a MessageBox directly after it and it didn't appear before the monitor shut down. The strange thing is that the Precompiled version from the CD works fine so it must be a compilation problem. I am using the DirectX 8.1b SDK and the book uses DirectX 8.0a but since DirectDraw is version 7 and lower that won't matter. If anyone has an idea as to how I could solve this please tell me because it is currently blocking me from the beautiful paradise that is DirectX and I am growing towards insanity (or maybe OpenGL). My faulty application and the Precompiled one are HERE. But save all work before testing the faulty one. If you can make it work then also tell me because it could be my PC that is the problem. Thanks for any help. >>>>>>>>>>>>>>>>> Ilthigore <<<<<<<<<<<<<<<<< [edited by - ilthigore on December 21, 2002 8:21:20 AM] [edited by - ilthigore on December 21, 2002 10:30:43 AM]
Ilthigore<<<<<<<<<<<<<<<<<
oto76mm
oto76mm
I believe you type wrongly DirectDrawCreateEx Not CreateDirectDrawEx.

why have this code if(FAILED(lpDD->Initialize(NULL))) ?????
The IDirectDraw7::Initialize method initializes a DirectDraw object that was created by using the CoCreateInstance COM function. REMOVE IT, and try to run you application again.

Ilthigore
Ilthigore
Sorry, the code above was very ropey as I am just starting DirectDraw and I was typing that from the top of my head. Thanks for pointing out not to bother with the IDirectDraw7::Initialize. I have expelled it from my code, but it actually wasn''t in the sample one (so I''m the fool again). Any future readers of this post
------IGNORE THE SOURCE IN THE TOP POST-----
The real source is included within the zip with both the good application and the bad application. Thanks again to oto76mm for pointing out the errors of my ways but I still need help with this. I may E-Mail Microsoft soon to see if they have any idea as to why the DirectDrawCreate function could kill my monitor.

>>>>>>>>>>>>>>>>>
Ilthigore
<<<<<<<<<<<<<<<<<
Ilthigore<<<<<<<<<<<<<<<<<

Topic Locked

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

Sign in to reply to this topic.