Showing Desktop SW_DEFAULT

This is a discussion on Showing Desktop SW_DEFAULT within the Windows Programming forums, part of the Platform Specific Boards category; Hi. I have a little problem with finding the Desktop (as window). There is certain game that you cannot press ...

  1. #1
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133

    Showing Desktop SW_DEFAULT

    Hi.
    I have a little problem with finding the Desktop (as window). There is certain game that you cannot press Alt + Tab to get out of it so I made a simple program that you can but(!!!) if I Force the game to minimize (SW_FORCEMINIMIZE) then you would see your Desktop but the thing is the Desktop is much larger then normal (probably have something to do with the game resolution) so I thought showing the Desktop as Default but I don't know how to find the Desktop as window, do you know a way to do that? Thanks, Yuri.

    This doesn't work because he cannot find the window (used WinSpy for the Caption)
    PHP Code:
    if ( ! hwnd FindWindow 0"FolderView" ) )
            
        
    Beep 10001000 );
        
    else
        
        
    ShowWindow hwndSW_DEFAULT ); 
    Yes it beeps, , why isn't "FolderView" correct?

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    ShowWindow ain't gonna do it. A "well-behaved" DirectX application would allow Alt+Tab, performing the following:-

    When you Alt+Tab away from the game window - change display resolution back to the default.

    When you Alt+Tab into the game window - change display resolution to the game's needs.

    Therefore, if the game isn't doing it, then you'll have to use ChangeDisplaySettings to allow you to see the desktop at its proper size.

  3. #3
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    Ok, I am gonna look at the code, thx. The game can't Alt + Tab out, I agree, that really sux.

  4. #4
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    Really thanks that it works but now I have a lot bigger problem .
    When the game window is forced minimized then I set the ChangeDisplaySettings to 0, 0 for default and my Desktop looks normal then but when I show the game window after my it was forced minimized I get something reallt weirds (look at the .jpg), here is my code:

    PHP Code:
    hwnd FindWindow 0"Jedi KnightŪ: Jedi Academy (MP)" );
        
    ShowWindow hwndSW_FORCEMINIMIZE );
        
    hwnd2 FindWindow 0"Movie Battles II" );
        
    ShowWindow hwnd2SW_FORCEMINIMIZE );

    ChangeDisplaySettings 0);


    //Now the Desktop is shown and the game is forced minimized


    Sleep 10000 );
      
    ShowWindow hwndSW_RESTORE );
        
    ShowWindow hwnd2SW_RESTORE );
        
    Sleep 1000 );
        
    ChangeDisplaySettings 0CDS_RESET );
    /*
    Set the game window to what is was, I tried everything but it all
    gave me the same thing as the .jpg
    */ 
    Attached Images Attached Images  

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Before you restore the desktop, save the display settings the game is using by calling EnumDisplaySettings with ENUM_CURRENT_SETTINGS. Then use the saved settings to restore the game when ready.

  6. #6
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    (OM*G) I just wanted to post the exect same thing but then as a question, how to find those settings, really thanks dude!

  7. #7
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    Ok I got it to work now (it works for now on) but I just wanted to know if it really is fine, here is my code:

    PHP Code:
    #include <windows.h>

    using namespace std;

    DEVMODE ScreenSettings;

    HWND GameWindowExtraWindow;

    int main()
    {

        
    Sleep 20000 );

        if ( ! ( 
    GameWindow FindWindow 0"Jedi KnightŪ: Jedi Academy (MP)" ) ) )
        {

            
    MessageBox 0"Could not find the \"Jedi Academy\" window!""Error"MB_OK MB_ICONERROR );

            exit ( 
    );
        }

        
    EnumDisplaySettings NULL ,ENUM_CURRENT_SETTINGS, & ScreenSettings );

        
    ExtraWindow FindWindow 0"Movie Battles II" );

        
    ShowWindow ExtraWindowSW_HIDE );

        
    ShowWindow GameWindowSW_FORCEMINIMIZE );

        
    ChangeDisplaySettings 0);

        
    Sleep 5000 );

        
    ShowWindow GameWindowSW_RESTORE );

        
    ChangeDisplaySettings ( & ScreenSettingsCDS_RESET );

    Thanks, Yuri.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended Desktop Dimensions
    By Jaken Veina in forum Windows Programming
    Replies: 2
    Last Post: 01-16-2009, 09:15 AM
  2. Getting Icons from the Desktop
    By Mastadex in forum Windows Programming
    Replies: 6
    Last Post: 08-29-2007, 05:33 PM
  3. "Organizing" Your Desktop for Coding
    By skim in forum Windows Programming
    Replies: 2
    Last Post: 03-13-2006, 06:52 PM
  4. Do you use your desktop?
    By MethodMan in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 12-06-2002, 04:06 AM
  5. Desktop of remote PC
    By Unregistered in forum Windows Programming
    Replies: 11
    Last Post: 10-10-2001, 06:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21