tags:

views:

81

answers:

4

How to run a C++ Console Program in full screen ? , using VS2008

A: 

Just a workaround: You could use some sort of earlier DOS video modi, for example...

asm
{
    mov     ax, 13h
    push    bp
    int     10h
    pop     bp
}

...to have a resolution of 320x200 pixels.

But I'm not sure if this would work for a windows application... Probably not!

Flinsch
No, it won't work for window's applications. It will only work on DOS, in real mode.
Joe D
+1  A: 

There are not a lot of video adapters around these days that still support this. Run cmd.exe and press Alt+Enter. If you get a message box that says "This system does not support fullscreen mode" then you're done. If it does switch to full screen then you can use SetConsoleDisplayMode() in your main() function. Of course, you don't know what your customer's machine is like, best not to pursue this.

Hans Passant
+4  A: 

Just tested this with cl fullscreen.cpp :

#include <iostream>
#include <windows.h>

#pragma comment(lib, "user32")

int main()
{
    ::SendMessage(::GetConsoleWindow(), WM_SYSKEYDOWN, VK_RETURN, 0x20000000);

    std::cout << "Hello world from full screen app!" << std::endl; 
    std::cin.get();
}

Unfortunatelly it had duplicated the text on the second monitor :)

Cristian Adam
Thanks this works but Windows 7 doesn't support to make a cmd window full-screen !
Sudantha