This works fine for console mode. Otherwise, for windows you have to resort to api calls or DirectX
For example, you use SendMessage with WM_CLEAR to clear a textbox or editbox. In the Windows Environment you do not usually wipe the whole window (DirectX and gaming excepted),
just some of the embedded controls.
Oh thanks. I only wanted it for console mode, I was just wondering if you're better off doing it another way so that it would be compatible on other non-windows systems or something.
Hi Rick,
For what it's worth, I spent last month learning a lot of console stuff. C++ allows for tons of commands which I found in a help file and printed out just for consoles.
I am attaching a ZIP file with 21 demos, each with comments. Demo 21 demontrates color, positioning cursor and clearing the screen with functions constructed from these functions. Being an old QBASIC programmer, I have built CLS, QBCOLOR and LOCATE. Not sure if this is the best, but it sure works for my purposes.
These are all written for Dev-C++ 4.01 so they have a system("pause") in each of them to keep the console from disappearing on you.
Oh year, I put some functions in a demo.h file. I know you're not supposed to do that...but I'm a new guy...that's my excuse. ;-)
And I couldn't get the clrscr to work in conio under VC++ (I knew about it because we breifly did C++ at college). VC++ doesn't seem to like a lot of things, I'd permanently move to Dev-C++ if it had the tooltip thing for function arguments
1. Create Win32 console, empty project in VC.
2. Add demo.h and main21.cpp.
3. Add "using namespace std;" just below the includes. I had forgot this. Dev-C++ doens't care but VC does.
4. Build and Run.
All of the commands in this sample above can be found by searching your VC help file...so you don't need to leave VC.
Here is a tip that you might find useful.
I have made shortcuts to my taskbar for the following help files associated with MSDN and VC++:
I got all the files to work anyway Chuck. Although I don't think I have the MSDN help files as I installed the Student Licence. I think there was a CD for the help files but it didn't work, or something like that.