Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Very simple ...I think

Posted on 2003-11-17
8
Medium Priority
?
270 Views
Last Modified: 2010-04-01
I'm just learning c++ and i thought it would be cool for me to learn to do this

How do i change the font color in the DOS window in a Console Wizard project?

I'm using c++ 3
0
Comment
Question by:learning_t0_pr0gram
8 Comments
 
LVL 1

Expert Comment

by:igor_sk
ID: 9768974
Compile your console program and run it. DOS window will open.
Select Properties from the system menu.
Change a font to one of the list and press OK.
You will be prompted wether you want to 'Apply these settings to current window only' or to 'Save properties for future windows with the same title'.
Select 'Save properties for future windows with the same title' and press Ok.

After that any time you run this console applicatioin from dev studio, you will have the same font.
0
 
LVL 4

Author Comment

by:learning_t0_pr0gram
ID: 9768976
isn't there a line of coding to do it so when someone else opens it it will work?
0
 
LVL 4

Author Comment

by:learning_t0_pr0gram
ID: 9769042
that doens't change the color anyway.. how do i change the color of the text?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Assisted Solution

by:lwinkenb
lwinkenb earned 80 total points
ID: 9769301
#include <wincon.h>

int main()
{
     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED);
     cout << "This should be red text";
     return 0;
}
0
 
LVL 4

Author Comment

by:learning_t0_pr0gram
ID: 9775864
when i put that, it goes into the wincon.h file and highlights:

typedef struct _COORD {
    SHORT X;
    SHORT Y;
} COORD, *PCOORD;

the SHORT X;

and it says "Type name executed"

??
0
 
LVL 1

Accepted Solution

by:
jploeg earned 80 total points
ID: 9778860
Use:
#include <windows.h>

instead of wincon.h
0
 
LVL 4

Author Comment

by:learning_t0_pr0gram
ID: 9782923
thanks, it works now
0
 
LVL 4

Author Comment

by:learning_t0_pr0gram
ID: 9782936
thanks, it works now
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question