newbie questions again

This is a discussion on newbie questions again within the C++ Programming forums, part of the General Programming Boards category; hi at first: i use ms vc++ 5.0 learning edition and windows 98. my programs runs in the 32bit windows ...

  1. #1
    Registered User dune911's Avatar
    Join Date
    Sep 2001
    Posts
    140

    Arrow newbie questions again

    hi

    at first: i use ms vc++ 5.0 learning edition and windows 98.
    my programs runs in the 32bit windows console, not in dos.

    i have some questions again:

    how can i color the text displayed in my program?
    i've heard something about
    textcolor(RED): for ex. RED
    textcolor(4); for ex. RED
    setcolor(4); for ex. RED
    but they're not working.
    is this an extra header-file? i use iostream.h and conio.h

    or do i have to change to fullscreen mode before i can do this? i also heard something about SetVideoMode(); to change into 320x240x32 video mode. but this isn't working, too. can anyone tell me how to use this function correctly?

    graphics, or better: pictures. i want my program to display pictures. i think they must be in pcx or bmp, am i right? do i have to put them into a 320x240 pixels picture because of the video mode?

    i think that's all (and enough *g*) for now!
    thanks for your help!
    dune911

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    try making a call to clrscr() before yo make the textcolor() call, they are in conio.h

    hth
    Monday - what a way to spend a seventh of your life

  3. #3
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291

    Re: newbie questions again

    I'm probably wrong...

    how can i color the text displayed in my program?
    i've heard something about
    textcolor(RED): for ex. RED
    textcolor(4); for ex. RED
    setcolor(4); for ex. RED
    but they're not working.
    is this an extra header-file? i use iostream.h and conio.h
    Since you're doing windows console applications,
    you probably need to use the console functions in
    windows.h. Try the SetConsoleTextAttribute()
    function. Here's where you can find information
    about it: SetConsoleTextAttribute

    Code:
    /********************************
    The SetConsoleTextAttribute is a function
    even though it looks wierd. It kept cutting the
    function in half when I posted it as one line.
    **********************************/
    #include <iostream.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <windows.h>
    #include <conio.h>
    
    int main()
    { 
      cout<<"Change Text Color. By me, static.\n";
     
      SetConsoleTextAttribute 
      (
        GetStdHandle(STD_OUTPUT_HANDLE),
        FOREGROUND_RED
      );
    
      cout<<"This is probably red...\n";
    
      SetConsoleTextAttribute 
      (
        GetStdHandle(STD_OUTPUT_HANDLE),
        FOREGROUND_RED | FOREGROUND_BLUE
      );
    
      cout<<"This is probably purple...\n";
    
      SetConsoleTextAttribute 
      (
        GetStdHandle(STD_OUTPUT_HANDLE),
        FOREGROUND_RED | FOREGROUND_BLUE |
        FOREGROUND_INTENSITY
      );
    
      cout<<"This is probably a prettier purple...\n";
      getch();
      return 0;
    }

    graphics, or better: pictures. i want my program to display pictures. i think they must be in pcx or bmp, am i right? do i have to put them into a 320x240 pixels picture because of the video mode?
    You can't display pictures in console apps. (it
    says so in the FAQ). There's some code that
    displays a bitmap in a DOS app, in the FAQ, but
    you need a DOS compiler.

    Excuse spelling/Grammar
    Staying away from General.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory handling functions (newbie questions)
    By PaulBlay in forum C Programming
    Replies: 6
    Last Post: 03-10-2009, 06:37 AM
  2. newbie questions
    By raptorx in forum C Programming
    Replies: 2
    Last Post: 10-10-2007, 09:30 PM
  3. Im a newbie to C and i have some questions
    By pave1104 in forum C Programming
    Replies: 5
    Last Post: 07-05-2006, 09:48 PM
  4. newbie questions
    By jp37 in forum C++ Programming
    Replies: 3
    Last Post: 12-04-2003, 08:31 PM
  5. Real newbie with VC6 questions
    By MagiZedd in forum Windows Programming
    Replies: 8
    Last Post: 10-15-2001, 08:27 PM

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