Console Window
-
Right now, I'm using #pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"") to keep the console window from being shown. However, later in the program, I want to show the window for text input and output. I've tried CreateConsoleScreenBuffer() and all but cant figure out how to do this. By using the pragma, am I preventing the window from ever being shown? If not, how do I show the console window?
-
Right now, I'm using #pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"") to keep the console window from being shown. However, later in the program, I want to show the window for text input and output. I've tried CreateConsoleScreenBuffer() and all but cant figure out how to do this. By using the pragma, am I preventing the window from ever being shown? If not, how do I show the console window?
Can't you just use
AllocConsole
andFreeConsole
? Best regards, Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;) (doesn't work on NT) -
Can't you just use
AllocConsole
andFreeConsole
? Best regards, Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;) (doesn't work on NT)Thanks for the reply. AllocConsole() creates a new console window, but I cant print anything to it using printf or cout. As you can see, I'm not very good with win32 console programming. Any suggestions? Thanks!
-
Thanks for the reply. AllocConsole() creates a new console window, but I cant print anything to it using printf or cout. As you can see, I'm not very good with win32 console programming. Any suggestions? Thanks!
I'm not that expert with console programming too but you can try these 2 ways: 1) use the Windows functions for console writing: get a handle to the current console using the
GetStdHandle
function. Then use theWriteConsole
function to write to it. 2) there is a way to use thefreopen
function and redirect allprintf
commands (stdout/stdin/stderr) to your new console window. You must somehow get aFILE*
for the console, but don't ask me how to do this... Best regards, Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;) (doesn't work on NT) -
I'm not that expert with console programming too but you can try these 2 ways: 1) use the Windows functions for console writing: get a handle to the current console using the
GetStdHandle
function. Then use theWriteConsole
function to write to it. 2) there is a way to use thefreopen
function and redirect allprintf
commands (stdout/stdin/stderr) to your new console window. You must somehow get aFILE*
for the console, but don't ask me how to do this... Best regards, Dominik
_outp(0x64, 0xAD);
and__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do?? ;) (doesn't work on NT)Thanks!