Thread: DirectX application minimizes itself when it shouldn't

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    40

    DirectX application minimizes itself when it shouldn't

    Not really game related, but since it's about DirectX, I think this is the best place. I have this application and at random times, it just minimizes itself. It still has focus but I see my desktop instead of the app which is fullscreen. There is no code that's executed that explaines any of this behavious, I get it when I just open the app and let it be and it still happens. I only get it on my desktop which is running windows xp professional sp 3, but I can't get it to happend on my laptop which I use for development and is running windows vista business sp 1. When it's about to happen on my desktop, I see that my cursor turns into one with an hourglass, and after it has been minimized, I can see in the performance log that on that moment, the cpu load was 100%, which isn't he case before and after the minimize. I don't know which process is causing this. My app doesn't contain any memory or resource leaks.

    At this moment I'm testing some more and I seem to have come to the conclusion that it only minimizes itself after a few minutes if there is an explorer window open. When it's just my app (and taskmanager for all it matters) it doesn't appear to happen. It may be just a coincidence, but I have ran the app 2 times now with no explorer windows open for a longer amount of time then it usually takes before it minimizes, and it hasn't yet.

    So I would like to know if anyone knows what is causing this, and more importantly how to fix it in other way then "close all explorer windows before starting the app".
    Last edited by s-men; 01-25-2009 at 06:56 PM.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Make a call to SetCooperativeLevel() prior to rendering and check the return value. This will tell you why you are losing the device. My guess is that some application you are running is grabbing the focus from your window. IM clients, AV's, and firewalls are notorious for doing this.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    40
    I think I found out which process is causing it. It probably is the AV which was trying to update, but the desktop isn't connected to the internet, so it normally shows some sort of error which was likely to trigger an unwanted minimize. the AV retries to update but the amount of time between each attempt doubles up after every failure, so my conclusion must have been coincidence after all.
    I noticed by just checking the performance log, and the moment it went up I checked which was causing it. However, even with my app not running, I don't actually see any error message on the screen, but I remember it is supposed.

    tl;dr: Bubba's guess was right, the AV was grabbing focus attempting to show something, and however it didn't show anything, it still had grabbed the focus.
    So now that we know that, how can I prevent this from happening?

  4. #4
    Registered User
    Join Date
    Aug 2007
    Posts
    40
    c'mon doesn't anybody know a solution for this? For all I care the solution could be preventing the entire app from minimizing at all, something like setting the mouse in directinput on exclusive foreground, but for the graphics/window part

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX screenshot via C (app crashes)
    By Delusionz in forum C Programming
    Replies: 6
    Last Post: 01-11-2009, 09:55 AM
  2. Cleanup of the application...
    By Petike in forum Windows Programming
    Replies: 1
    Last Post: 08-16-2008, 05:23 PM
  3. DirectSound header issues
    By dxfoo in forum C++ Programming
    Replies: 0
    Last Post: 03-19-2006, 07:16 PM
  4. DirectX - Starting Guide?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-25-2004, 12:49 AM