Quote Originally Posted by 2kaud View Post
A couple of thoughts for you to think about - now that you're refreshed.

1) As Victor mentioned in a previous post, you are not checking for an error using GetStdHandle. You are assuming that a console is present and that you can get its handle. What happens if no console is present? Why not obtain the handle once in the class constructor and if not valid allocate a console? Something like this

Code:
//in private
HANDLE hout;

...
//In constructor
if ((hout = GetStdhandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
     FreeConsole();
     if (!AllocConsole()) {
          MessageBox(0, "Cannot allocate console", "Console class", MB_OK | MV_ICONSTOP);
     } else {
         if ((hout = GetStdhandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) {
             MessageBox(0, "Cannot obtain console handle", "Console class", MB_OK | MV_ICONSTOP);
         }
     }
}
2) What if 2 or more instances of your console class are created? IMO at present with your class design they would independently perform their functions on the same console window. So you might have one class instance writing data and another instance clearing the console or trying to write different data to the same locations etc etc? Have you thought about having a differen console window for each instance - or do you want each class instance to share the same console?
lol i'm eating a big 'sandwiches' of very information in same time lol
thanks for all to both.. thanks