Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

Make money selling software. Check this out here

Hosted clickbank mall. Check this out here




   Misc

   Amazon

   Links

    


Coloured text example
 

 

 

Description

This changes the color of the text / background of the text in a console window . Experiment with different numbers for setcolor(). Useful for menus .

Code

#include <stdio.h>
#include <windows.h>
#include <conio.h>


void setcolor(unsigned short color)
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon,color);
}

int main()
{
setcolor(1);
printf("thisll be blue\n");
setcolor(2);
printf("how about some green\n");
setcolor(5);
printf("and another color\n");

getch();


return 0;
}

Information

Tested on Visual C++

 

 

 

 

Download

setcolour.txt


 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
Internet example(C)
A basic calculator(Javascript)
Image display(ASP.net)
Block more than one IP address(ASP)
App path in VB.net(VB.net)
display the available mac addresses(C Sharp)
Latest stock market information(PHP)
Random URLs(PHP)

    




Copyright © 2003 by programmershelp.co.uk