Console application for command line emulation
Windows has a whole API for writing Console Mode applications. It allows you to listen for mouse or keyboard input in event mode, as well as set foreground and background text colors, position the cursor, etc.
To make a box like the one displayed by CMD.EXE, you use certain special characters to make the border (there are various corner pieces and pieces), use the Symbol Map app to see them all).
To use the Console API from C # you probably need to use pinvoke like
[DllImport("kernel32.dll")]
public static extern bool SetConsoleTextAttribute(
IntPtr hConsoleOutput, int wAttributes);
Refer to the docs for SetConsoleTextAttribute for how to use it to set color.
a source to share
I'm not sure if .NET includes wrappers for them or if you have to use them via P / Invoke, but the Win32 API includes functions to do this. For example, you can use ReadConsoleOutput
to read the block of the display you are going to hide. Then you can use WriteConsoleOutput
to display the list (including border). When you're done with the overlay, you'll restore the previous content with another call WriteConsoleOutput
, specifying the block where you saved the underlying data.
Edit: doing a quick check, the correct functionality doesn't jump out at me anyway. Maybe I missed something obvious though ...
a source to share
