#define LEFT 0
#define RIGHT 1
int xpos = 10;
int direction = RIGHT;
string mystr(" hello, there... ");
HDC hdc = GetDC(hWnd);
while(program is runnning)
{
while (PeekMessage(&Msg, NULL,0,0,PM_REMOVE)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
if (direction == LEFT) { xpos--; if (xpos < 10) direction = RIGHT; }
if (direction == RIGHT) { xpos++; if (xpos > 600) direction = LEFT; }
TextOut(hdc,xpos,30,mystr.c_str(),mystr.size());
}
ReleaseDC(hWnd, hdc);
Note that i left an empty space on both sides of the message, so that it doesn't leave a trail of text.
Now as for the snake game under the console, that is almost impossible with out using conio.h because you need gotoxy and textcolor() and textbackground() to set colors and paint the snakes....the problem is conio.h is not really portable...I think your better off trying it with windows GDI which, I have already done :) game is almost finished.
There's a whole article about clearing the console, which you can find in the stickied thread at the top of the "Articles" section of this forum. The best standard way is to print a large number of newlines, however I would definitely recommend using a curses library, such as ncurses or PDCurses, as chrisname suggested. :)