Thread: Check to see if it is fullscreen...

  1. #1
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204

    Thumbs up Check to see if it is fullscreen...

    Is there anyway to check to see my console program is in fullscreen?

    Thanks.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    For NT versions of windows, there's always been a "GetConsoleDisplayMode" function in Kernel32, but has only been documented for XP and Vista. But it works in 2K as well.
    Code:
    /*-----------------------------------------------------------------------------
    NT_GetConsoleDisplayMode - Get the display mode of the current console.
    
    Parameters:
        pdwMode - [out] A non-zero value indicates full screen
    
    Returns Values: 
        TRUE if successful, otherwise FALSE is returned. Call GetLastError() for 
        extended information.
    
    Remarks:
        This only works on NT based versions of Windows.
    -----------------------------------------------------------------------------*/
    BOOL NT_GetConsoleDisplayMode(DWORD *pdwMode)
    {
        typedef BOOL (WINAPI *GCDMProc_t) (LPDWORD);
        GCDMProc_t GetConsoleDisplayMode;
        HMODULE hKernel32;
        BOOL bFreeLib = FALSE, ret;
        const char KERNEL32_NAME[] = "kernel32.dll";
    
        hKernel32 = GetModuleHandleA(KERNEL32_NAME);
        if (hKernel32 == NULL)
        {
            hKernel32 = LoadLibraryA(KERNEL32_NAME);
            if (hKernel32 == NULL)
                return FALSE;
    
            bFreeLib = true;
        }//if
    
        GetConsoleDisplayMode = 
            (GCDMProc_t)GetProcAddress(hKernel32, "GetConsoleDisplayMode");
    
        if (GetConsoleDisplayMode == NULL)
        {
            SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
            ret = FALSE;
        }//if
        else
        {
            ret = GetConsoleDisplayMode(pdwMode);
        }//else
            
        if (bFreeLib)
            FreeLibrary(hKernel32);
    
        return ret;
    }//NT_GetConsoleDisplayMode
    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. Going to fullscreen with DEVMODE
    By Da-Nuka in forum Windows Programming
    Replies: 2
    Last Post: 06-15-2005, 08:13 AM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM