Texte coloré
Fermé
informatiqueabc
Messages postés
5
Date d'inscription
mardi 7 avril 2015
Statut
Membre
Dernière intervention
7 mars 2016
-
11 janv. 2016 à 20:17
Weshguy - 22 févr. 2016 à 20:56
Weshguy - 22 févr. 2016 à 20:56
1 réponse
Si tu est sur console, tu dois faire:
// Text Color.cpp : main project file.
#include <stdafx.h>
#include <stdio.h>
#include "conio.h"
#include <iostream>
#include <windows.h>
using namespace std;
int main ( void )
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, FOREGROUND_RED & FOREGROUND_BLUE | BACKGROUND_BLUE | FOREGROUND_INTENSITY | BACKGROUND_INTENSITY );
printf ( "This is a test\n" );
SetConsoleTextAttribute ( h, wOldColorAttrs);
return 0;