C++ Full Screen

This is a discussion on C++ Full Screen within the C++ Programming forums, part of the General Programming Boards category; It should work in NT/2k and probably XP, but not on 9X....

  1. #16
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    It should work in NT/2k and probably XP, but not on 9X.
    zen

  2. #17
    Unregistered
    Guest

    Red face

    Go to www.gamedev.net and download one of their tutorials on 3D Meshing or something. All have a dialogue that asks if you want to run the program in full screen mode or in a Window. You can just download the source and find your answer.

  3. #18
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    I doubt they are doing their 3dmeshing in a Console window though.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #19
    Registered User
    Join Date
    Aug 2001
    Posts
    47
    I believe those tutorials are by NeHe and instruct the use of OpenGL under Windows.

  5. #20
    Unregistered
    Guest
    Thanks zen, your code seems to work perfectly, THANXXX!!!

  6. #21
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    haha, its raj! Anyhoo, Im in the same class and on the same project and I tried this:
    Originally posted by zen
    You can maximise the Win32 console with something like -

    Code:
    #include <windows.h>
    
    int main()
    {
      
    	HANDLE hConsole;
    	COORD size;
    	HWND hWnd;
    		
    	hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    	size = GetLargestConsoleWindowSize(hConsole);
    	SetConsoleScreenBufferSize(hConsole,size);
    	SetConsoleTitle("test");
    	hWnd = FindWindow(NULL,"test");
    	
    	ShowWindow(hWnd,SW_MAXIMIZE);
    
            //Your code
    
    	return 0;
    	
    }
    It's not the same as alt-enter, though.
    and it managed to lock up my computer after giving a whole bunch of weird blank screens of not normal size.
    Raj, I think you'd be best off just putting a cout at the start of your code telling the user to maximize the window.

  7. #22
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Raj, I think you'd be best off just putting a cout at the start of your code telling the user to maximize the window.
    Not only would it be easier, it would also be polite to do so. I am using Windows here. Windows. Not PutAllMyAppsInFullScreenOneAfterAnother-os. If I like it fullscreen, I will see to it, but for gods sake, don't hold my screen hostage with a console application. Console applications are never fullscreen. If you think it's nicer fullscreen, then make it optional to start your program with a parameter to do so. Or specifiy it in the link. Or show a message to the user saying "Press Alt-Enter for fullscreen view." Just don't zapp my screen when your program runs.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  8. #23
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    In response to some of the earlier posts on the first page, you could do anything with assembler, but you'd have to do some pretty grimy (as in, really unsheltered and close to the system) work with DEBUG. Mu suggestion is a program that came with Windows 3.1. I can put it on here as an attachment if you want (because I'm probably the only one here that actually still uses 3.1... (*feels poor* *IS poor*)). It would edit exe files and change their properties so they can, like you suggested, open in full screen mode. I'll put it on here later today!

  9. #24
    Registered User
    Join Date
    Aug 2001
    Posts
    72

    late reply

    Hi

    'al+enter' can be simulated with keybd_event API
    Code:
        keybd_event(VK_MENU,0x38,0,0);
        keybd_event(VK_RETURN,0x1c,0,0);
        keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
        keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
    note: the VK_xxx are used for information purposes here since the kbd scan codes (second params) are used,if present instead of them.

    hope it works 4u

    damyan

  10. #25
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    493
    tanx all, i found another function , maybe it can be help to some one like me again .
    Code:
    // typedef function pointer for undocumented API
    
    typedef BOOL WINAPI (*SetConsoleDisplayModeT)(HANDLE,DWORD,DWORD*);
    
    BOOL WINAPI FullScreenConsoleNT(void)
    {
        // get handle to stdout
    
        HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    
        DWORD newmode = 1;	// fullscreen mode
    
        DWORD oldmode;
    
        // declare instance of function pointer
    
        SetConsoleDisplayModeT SetConsoleDisplayMode;
    
        // get handle to kernel32.dll
    
        HINSTANCE hK32 = GetModuleHandle("KERNEL32.DLL");
        if ( hK32 == NULL ) {
            // highly unlikely but good practice just the same
    
            return FALSE;
        }
    
        // assign procedure address to function pointer
    
        SetConsoleDisplayMode = ( SetConsoleDisplayModeT )
    		GetProcAddress(hK32,"SetConsoleDisplayMode");
    
        // check if the function pointer is valid
    
        // since the function is undocumented
    
        if ( SetConsoleDisplayMode == NULL ) {
    	return FALSE;
        }
    
        // pause before changing to fullscreen
    
        Sleep(500);
    
        // set full screen mode
    
        SetConsoleDisplayMode(hStdOut,newmode,&oldmode);
    
        return TRUE;
    
    }
    Highlight Your Codes
    The Boost C++ Libraries (online Reference)

    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.."
    Bill Bryson


  11. #26
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    By the way, the moderators generally prefer you to not bump threads older than two weeks. This thread was last active in 2002!

    To moderators: you might want to split these posts into this other (new) thread on this topic. how can i make the console window go maximised?

    [edit] That looks *very* unportable. Undocumented features are often undocumented for a reason . . . . [/edit]
    Last edited by dwks; 06-12-2009 at 02:57 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Opening in full screen
    By MaGaIn in forum C++ Programming
    Replies: 14
    Last Post: 08-21-2007, 12:12 PM
  2. Full Screen
    By Rainer in forum C++ Programming
    Replies: 4
    Last Post: 08-08-2003, 06:56 AM
  3. !!!!!!Full screen!!!!!
    By Lukas in forum C++ Programming
    Replies: 2
    Last Post: 03-19-2003, 04:43 AM
  4. full screen
    By DominicTrix in forum Windows Programming
    Replies: 2
    Last Post: 04-21-2002, 07:13 AM
  5. Full Screen
    By JamMan in forum C++ Programming
    Replies: 3
    Last Post: 11-21-2001, 03:10 PM

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