cout<< only in box in corner

This is a discussion on cout<< only in box in corner within the C++ Programming forums, part of the General Programming Boards category; I wish to cout<< in this case "blahhhhhhhhhhhhhhhhhhhhhhhhhh"; in a small box in the corner of my console and only ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    16

    cout<< only in box in corner

    I wish to cout<< in this case "blahhhhhhhhhhhhhhhhhhhhhhhhhh";
    in a small box in the corner of my console and only in the small box in my console...
    however i don't want to have to alter my text every time i do it so it fits...
    I just want to type " blahhhhhhhhhhhh" and if the box ends half way in between " blahhhhhhhhhhhh" then it simply cout<<s the rest on the next line...

    This is what i have....
    thought about it donno how to do it from here...]

    MSVC++ 6.0

    --------------------------------------------------------
    #include <iostream.h>
    #include <windows.h>

    void VidScr(const char*);
    void gotoxy(int x, int y);

    int main()
    {
    VidScr("Blahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
    return 0;

    }

    void VidScr(const char display[255])
    {
    int length = strlen(display);

    gotoxy(1,15);
    cout<< "=============================="<<endl;
    gotoxy(1,1);
    cout<< "================================================= ============================"<<endl;

    for (int j=2;j<=22;j++)
    {
    gotoxy(1,j);
    cout<< "|"<<endl;
    }

    for (int k=2;k<=22;k++)
    {
    gotoxy(77,k);
    cout<< "|"<<endl;
    }

    for (int i=16;i<=22;i++)
    {
    gotoxy(30,i);
    cout<< "|"<<endl;
    }

    gotoxy(1,23);
    cout<< "================================================= ============================"<<endl;

    gotoxy(2,16);
    cout<< display<<endl;

    i=0;

    }

    gotoxy(1,24);
    }


    void gotoxy(int x, int y)
    {
    COORD coord;
    coord.X = x;
    coord.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord);
    }
    Last edited by CARBUNCLE; 05-01-2002 at 09:10 PM.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    16

    Well...

    I figured this would a bigger problem and almost noone would know how to do it.... so i'm not surprised....
    but this is my last try....
    does anyone know how to do this???

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I believe you could "set a new window" as a portion of the old window. The text written will only be placed inside this. It's something like SetWindow(int Left, int Top, int Right, int bottom);

    Can't remember exactly, this knowledge is long forgotten...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual Box
    By ssharish2005 in forum Tech Board
    Replies: 3
    Last Post: 02-12-2009, 04:08 AM
  2. Replies: 9
    Last Post: 02-13-2008, 01:59 PM
  3. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 08:34 PM
  4. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 07:00 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21