Writing on console window overlay?

c#, console-application

Solution

Quite possibly they're using Console Screen Buffers. That is, they save the current buffer and create a new one for the application to use. When the application is done, it puts the original screen buffer back.

I wrote an article about using Console Screen Buffers in .NET some years ago. Check out http://www.devsource.com/article2/0,1895,2011496,00.asp

Full source is available at http://www.mischel.com/pubs/consoledotnet/consoledotnet.zip

Problem

What I can't seem to find out is if it is possible in a C# console application to write text in some kind of layer over the top of the existing window and text for say a progress bar or information. I've seen power shell cmdlets that do it, to display a progress bar and then when its finished the progress bar goes away and whatever was underneath is visible. The bars I've seen also stay in position even if additional console output causes the window to scroll. Anyone any ideas? Edit: Heres an example of powershell doing it using Write-Progress http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-76-18-metablogapi/8726.WES_2D00_1_2D00_29_2D00_11_2D00_2_5F00_2587E97F.jpg

Original source