RSS Forums RSS

Full screen console applications

Please support our C++ advertiser: Programming Forums
Reply
Posts: 73
Reputation: nanodano is an unknown quantity at this point 
Solved Threads: 2
nanodano's Avatar
nanodano nanodano is offline Offline
Junior Poster in Training

Full screen console applications

  #1  
May 19th, 2006
Hey,


I have a problem using Visual Studio 2005. In the MSDN library it says there is a function called SetConsoleDisplayMode. This function though is not in the 2005 library. I'm assuming its an old reference from VS 2003. Does anyone know how to tell a console program to switch into full screen mode?

Any help is appreciated.
- Daniel
AddThis Social Bookmark Button
Reply With Quote  
Posts: 596
Reputation: SpS is on a distinguished road 
Solved Threads: 31
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: Full screen console applications

  #2  
May 19th, 2006
Here's a code snippet which I found.
#include <windows.h>
#include <iostream>

BOOL NT_SetConsoleDisplayMode(HANDLE hOutputHandle, DWORD dwNewMode)
{
    typedef BOOL (WINAPI *SCDMProc_t) (HANDLE, DWORD, LPDWORD);
    SCDMProc_t SetConsoleDisplayMode;
    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

    SetConsoleDisplayMode = 
        (SCDMProc_t)GetProcAddress(hKernel32, "SetConsoleDisplayMode");
    if (SetConsoleDisplayMode == NULL)
    {
        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
        ret = FALSE;
    }//if
    else
    {
        DWORD dummy;
        ret = SetConsoleDisplayMode(hOutputHandle, dwNewMode, &dummy);
    }//else
        
    if (bFreeLib)
        FreeLibrary(hKernel32);

    return ret;
}//NT_SetConsoleDisplayMode

int main( void )
{
  NT_SetConsoleDisplayMode( GetStdHandle( STD_OUTPUT_HANDLE ), 1 );
  std::cin.get();
  return 0;
}
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 3916 | Replies: 1 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:03 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC