Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28543 Discussions

Setting location of Console & clearing contents?

rkaehler
Beginner
245 Views

Is there a programatic way to set the initial location of a console window created using AllocConsole() (or move it after creation)?

Also, is there a way to clear the console buffer?

TIA

0 Kudos
1 Reply
anthonyrichards
New Contributor III
245 Views
Quoting - rkaehler

Is there a programatic way to set the initial location of a console window created using AllocConsole() (or move it after creation)?

Also, is there a way to clear the console buffer?

TIA

Look in the language help index and you will find loads of Windows API console functions.

To move the console window, use SetConsoleWindowInfo to place the console window where you want it. It needs a console screen buffer handle as an argument.

To wipe the console window, create another console screen buffer using CreateConsoleScreenBuffer, save its handle.
Switch to the new (empty) buffer using SetConsoleActiveScreenBuffer.
Delete buffers that are no longer required using the CloseHandle function.

0 Kudos
Reply