SetDisplayMode in DirectDraw causing problems
3 replies to this topic
Members - Reputation: 122
Posted 17 January 2000 - 11:34 AM
I posted earlier about this problem and a guy suggested that I reinstall directx. It worked, however, it is doing it again and I think it was fixed by accident when I edited something, and not the reinstall, and I am not sure what it was I changed. I am writing a simple Direct3D app that draws a single triangle, however the DirectDraw portion of the initialization failes. Apparently after I call SetDisplayMode I lost my Exclusive Mode from when I set the cooperative level. In order of what I am doing this is how it happens 1 CreateDirectDrawEx() using the DirectDraw7 interface 2 SetCooperativeLevel() I set it to Fullscreen and Exclusive 3 SetDisplayMode() I use 640x480x16 and 0 for refresh/flags 4 CreateSurface() I go to create the surface, but it failes because apparently I lost exclusive mode after setting the display mode. I tried tricking it into reistablishing the Cooperative level by Using SetCooperativeLevel() again after setting the display mode, however, this was a hack and caused major problems later on It shows the triangle rotating, however my cursor is visable, despite me setting it not to be, and the mouse cursor reacts to apps "under" my program like when it moves over a text box where another program should be the cursor changes, and if I click on anything it tries to switch to the window I clicked on (but couldn't see) suggesting that I don't really have exclusive mode still. One other thing, I can compile and use all the samples just fine. I have even been able to get the triangle tutorial they use to go into full screen mode! I checked the way they did it to the way I did it, and except for variable names it is pretty much the same, but theirs works. Any clue on how to keep it from losing exclusive? -Omalacon --If anyone is interested, I can post my initialization code.. don't know if it will help or not. Edited by - Omalacon on 1/17/00 5:40:44 PM
Members - Reputation: 122
Posted 19 January 2000 - 01:41 PM
Got it working, apparently VC wasn''t giving me a warning (which is usually does) that I was passing a pointer to an HWND instead of my actual HWND to SetCoop. For some reason it still went through the function just fine, but when it tried to create the surface it failed since it didn''t truly have Exclusive. What I don''t get is why VC never gave me a warning about it. Normally it does, in fact normally it gives me an error! Are HWND and HWND * really the same type?