If I launch my DirectX program, full-screen initializes. If I alt tab out of it, it alt-tabs as normal. However, if I then maximize it so it has the focus of my computer again and then alt-tab for the second time, the window doesn't minimize. The taskbar shows up but the program doesn't minimize. It's like, the first time I alt tab it works perfectly normal but then second time I do it, it doesn't work. Anyone know why? I would really like to fix this. Thankssss..

Your description sounds like a flag may not be getting set correctly. does your program contain code that is executed when it is minimizes and maximized ? Does the same problem occur with other DirectX programs written by either yourself of someone else (attempting to isolate the problem to either your code of Microsoft's).

It works fine with games written by professional game companies so it isn't my computer and I don't handle any code when my game is minmized/maximized

I am not sure if you are using TestCooperativeLevel() correctly ....


If the device is lost and cannot be restored at the current time, TestCooperativeLevel throws a DeviceLostException. This is the case, for example, when a full-screen device loses focus. If an application detects a lost device, it should pause and periodically call TestCooperativeLevel until no exceptions are thrown. The application can then attempt to reset the device by calling Reset and, if this succeeds, restore the necessary resources and resume normal operation. Note that Present throws a DeviceLostException if the device is either "lost" or "not reset."
A call to TestCooperativeLevel fails if made on a thread other than the one used to create the device being reset.

It throws exceptions.... does not return anything ....

Here's a good game example using DirectX ... used directdraw but it should show you all the basic you need to know how to setup and handle a DX game app:

And for DirectX 9 tutorials:

Those are quite compleate in dealing with win32 basics and basic DX init

P.S Once you have a nice little windows and directx init/looping code wrap it all up into a nice set of classes/functions that you can reuse. It's really worth the time and effort ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.