Accueil > > > [VC++] LIBRAIRIE CONIO.H
[VC++] LIBRAIRIE CONIO.H
Information sur la source
Description
C'est Eric TETZ qui a fait ce prgm. Ayant obtenu son autorisation pour le distribuer un peu partout et bien je le fais parce que ça va arranger beaucoup de monde... Vous faites un petit Add to Project en sélectionnant les fichiers econio.h et econio.cpp Vous pouvez tout mettre aussi dans un seul fichier econio.h, le mettre avec les autres *.h de VC++ et faire un petit #include "econio.h"
Source
- // econio.cpp Définitions des fonctions
-
- #include <econio.h>
-
- static WORD bgcolor = BLACK;
- static WORD fgcolor = WHITE << 4;
- #define STDOUT GetStdHandle(STD_OUTPUT_HANDLE)
-
- void gotoxy( int x, int y ) // Place le curseur en x,y
- {
- COORD dwCursorPosition = { x, y };
- SetConsoleCursorPosition (STDOUT, dwCursorPosition);
- }
-
- int wherex( void ) // Renvoie la valeur de x
- {
- CONSOLE_SCREEN_BUFFER_INFO coninfo;
- GetConsoleScreenBufferInfo (STDOUT, &coninfo);
- return coninfo.dwCursorPosition.X;
- }
-
- int wherey( void ) // Renvoie la valeur de y
- {
- CONSOLE_SCREEN_BUFFER_INFO coninfo;
- GetConsoleScreenBufferInfo (STDOUT, &coninfo);
- return coninfo.dwCursorPosition.Y;
- }
-
- void textbackground( int newcolor ) // Change la couleur du texte
- {
- fgcolor = newcolor;
- SetConsoleTextAttribute (STDOUT, fgcolor | bgcolor);
- }
-
- void textcolor( int newcolor )
- {
- bgcolor = newcolor << 4;
- SetConsoleTextAttribute (STDOUT, fgcolor | bgcolor);
- }
-
- void setcursortype( int cur ) // type de curseur
- {
- BOOL visible = cur != NOCURSOR;
- CONSOLE_CURSOR_INFO CursorInfo = { cur, visible };
- SetConsoleCursorInfo (STDOUT, &CursorInfo);
- }
-
- void clrscr ( void ) // efface l'écran
- {
- HANDLE hstdout = STDOUT;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- if (GetConsoleScreenBufferInfo (hstdout, &csbi))
- {
- COORD coordScreen = { 0, 0 };
- DWORD cCharsWritten;
- DWORD dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
- FillConsoleOutputCharacter (hstdout, ' ', dwConSize, coordScreen, &cCharsWritten);
- FillConsoleOutputAttribute (hstdout, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
- SetConsoleCursorPosition (hstdout, coordScreen);
- }
- }
-
-
- // econio. h par Eric Teetz ( prototypes des fonctions )
-
- #ifndef ECONIO_H
- #define ECONIO_H
-
- #include <windows.h>
- #include <conio.h>
- enum CURSOR {
- NORMALCURSOR = 0,
- NOCURSOR = 100,
- SOLIDCURSOR = 20,
- };
-
- enum COLORS {
- BLACK = 0,
- BLUE = FOREGROUND_BLUE,
- GREEN = FOREGROUND_GREEN,
- CYAN = FOREGROUND_GREEN | FOREGROUND_BLUE,
- RED = FOREGROUND_RED,
- MAGENTA = FOREGROUND_RED | FOREGROUND_BLUE,
- BROWN = FOREGROUND_RED | FOREGROUND_GREEN,
- LIGHTGRAY = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
- DARKGRAY = FOREGROUND_INTENSITY,
- LIGHTBLUE = FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- LIGHTGREEN = FOREGROUND_GREEN | FOREGROUND_INTENSITY,
- LIGHTCYAN = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- LIGHTRED = FOREGROUND_RED | FOREGROUND_INTENSITY,
- LIGHTMAGENTA = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- YELLOW = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
- WHITE = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- };
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- void clrscr( void );
- void textbackground( int newcolor );
- void textcolor( int newcolor );
- void setcursortype( int cur );
- void gotoxy( int x, int y );
- int wherex( void );
- int wherey( void );
-
- #ifdef __cplusplus
- }
- #endif
- #endif /* ECONIO_H */
// econio.cpp Définitions des fonctions
#include <econio.h>
static WORD bgcolor = BLACK;
static WORD fgcolor = WHITE << 4;
#define STDOUT GetStdHandle(STD_OUTPUT_HANDLE)
void gotoxy( int x, int y ) // Place le curseur en x,y
{
COORD dwCursorPosition = { x, y };
SetConsoleCursorPosition (STDOUT, dwCursorPosition);
}
int wherex( void ) // Renvoie la valeur de x
{
CONSOLE_SCREEN_BUFFER_INFO coninfo;
GetConsoleScreenBufferInfo (STDOUT, &coninfo);
return coninfo.dwCursorPosition.X;
}
int wherey( void ) // Renvoie la valeur de y
{
CONSOLE_SCREEN_BUFFER_INFO coninfo;
GetConsoleScreenBufferInfo (STDOUT, &coninfo);
return coninfo.dwCursorPosition.Y;
}
void textbackground( int newcolor ) // Change la couleur du texte
{
fgcolor = newcolor;
SetConsoleTextAttribute (STDOUT, fgcolor | bgcolor);
}
void textcolor( int newcolor )
{
bgcolor = newcolor << 4;
SetConsoleTextAttribute (STDOUT, fgcolor | bgcolor);
}
void setcursortype( int cur ) // type de curseur
{
BOOL visible = cur != NOCURSOR;
CONSOLE_CURSOR_INFO CursorInfo = { cur, visible };
SetConsoleCursorInfo (STDOUT, &CursorInfo);
}
void clrscr ( void ) // efface l'écran
{
HANDLE hstdout = STDOUT;
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo (hstdout, &csbi))
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
DWORD dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter (hstdout, ' ', dwConSize, coordScreen, &cCharsWritten);
FillConsoleOutputAttribute (hstdout, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition (hstdout, coordScreen);
}
}
// econio. h par Eric Teetz ( prototypes des fonctions )
#ifndef ECONIO_H
#define ECONIO_H
#include <windows.h>
#include <conio.h>
enum CURSOR {
NORMALCURSOR = 0,
NOCURSOR = 100,
SOLIDCURSOR = 20,
};
enum COLORS {
BLACK = 0,
BLUE = FOREGROUND_BLUE,
GREEN = FOREGROUND_GREEN,
CYAN = FOREGROUND_GREEN | FOREGROUND_BLUE,
RED = FOREGROUND_RED,
MAGENTA = FOREGROUND_RED | FOREGROUND_BLUE,
BROWN = FOREGROUND_RED | FOREGROUND_GREEN,
LIGHTGRAY = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
DARKGRAY = FOREGROUND_INTENSITY,
LIGHTBLUE = FOREGROUND_BLUE | FOREGROUND_INTENSITY,
LIGHTGREEN = FOREGROUND_GREEN | FOREGROUND_INTENSITY,
LIGHTCYAN = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
LIGHTRED = FOREGROUND_RED | FOREGROUND_INTENSITY,
LIGHTMAGENTA = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
YELLOW = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
WHITE = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
};
#ifdef __cplusplus
extern "C" {
#endif
void clrscr( void );
void textbackground( int newcolor );
void textcolor( int newcolor );
void setcursortype( int cur );
void gotoxy( int x, int y );
int wherex( void );
int wherey( void );
#ifdef __cplusplus
}
#endif
#endif /* ECONIO_H */
Conclusion
Ben ya gotoxy, textbackground, wherex, wherey et puis de quoi s'amuser. Niqué Borland. Gnarf gnarf. GoldenEye
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
TECHDAYS PARIS 2012 : COMMENT SHAREPOINT A SAUVé MES TECHDAYSTECHDAYS PARIS 2012 : COMMENT SHAREPOINT A SAUVé MES TECHDAYS par ROMELARD Fabrice
Speakers : Lionel Limozin et Alain Marty La session commence par une découverte de SharePoint à travers la mise en place d'un environnement SharePoint pour la gestion des Sessions animées par BeWise. Le besoin est très ba...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice PERSPECTIVE 3.0 POUR SILVERLIGHT 5.0PERSPECTIVE 3.0 POUR SILVERLIGHT 5.0 par odewit
Je viens de publier la version 3.0 de Perspective pour Silverlight, qui regroupe un portage sous Silverlight 5.0 des fonctionnalités de Perspective 2.0, le framework 3D de haut-niveau introduit récemment et de nouveaux exemples de code. En voici la li...
Cliquez pour lire la suite de l'article par odewit TECHDAYS PARIS 2012 : TOP 10 DES BEST PRACTICES POUR SQL SERVERTECHDAYS PARIS 2012 : TOP 10 DES BEST PRACTICES POUR SQL SERVER par ROMELARD Fabrice
Speaker : Nadia Ben El Kadi Configuration machine La session commence par la toute première question à se poser lors de la mise en place d'environnement SQL Server, la configuration des machines : Type de mac...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : KINECT + OFFICE 365 UN BON GESTE POUR VOTRE SITECHDAYS PARIS 2012 : KINECT + OFFICE 365 UN BON GESTE POUR VOTRE SI par ROMELARD Fabrice
Speakers : Fabrice Barbin, Samuel Blanchard, Julien Lo Presti Titre Prometteur et attractif invitant à voir comment lier le composant ludique Kinect dans le cadre d'une structure IT classique, notamment au travers de la plat...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : PLEINIèRE DU PREMIER JOURTECHDAYS PARIS 2012 : PLEINIèRE DU PREMIER JOUR par ROMELARD Fabrice
KeyNotes du premier jour pour les développeurs. La session est principalement axée sur une des principales directions prise par Microsoft à travers tous ses nouveaux produits : Cloud privé ou public (Solution Azure) ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
C++ C++ par yesoun1
Cliquez pour lire la suite par yesoun1 OPNETOPNET par hth21
Cliquez pour lire la suite par hth21 RE : ARBRE BINAIRERE : ARBRE BINAIRE par pacotheking
Cliquez pour lire la suite par pacotheking
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|