C/Visual C - Conio en visual studio...gran duda..!!!!!

 
Vista:

Conio en visual studio...gran duda..!!!!!

Publicado por Rodrigo (1 intervención) el 21/09/2012 10:04:41
Hola a todos...


Bueno chicos, estoy aprendendo a programa en C por la escuela, y nos dan la licencia del Visual Studio...bueno tasca que haciendo un programita basico queria utilizar en comando texcolor de conio, pero no me deja. Sabeis como puedo solucionar este pequeño detalle?


Muchas gracias...bye
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Conio en visual studio...gran duda..!!!!!

Publicado por jose (4 intervenciones) el 22/09/2012 10:06:40
Buenas <conio.h> es de borlan c++
necesitas una libreria que simule el <conio.h> que es un archivo y secopia en la carpeta #include y otro archivo que se copia en la carpeta librerias tepone lo que tienes que hacer y pone un ejempo
busca por librerias en la web yo encontre la que simula la funcion gotoxy().
Tu funcion es texcolor() creo que es <conio2.h>.Suerte
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Conio en visual studio...gran duda..!!!!!

Publicado por Rodrigo (2 intervenciones) el 25/09/2012 19:38:50
Aupa Jose...!!!

Bueno, estuve mirando en internet y buscando lo que me dijiste, pero aun no he logrado, sabe minha intencion es hacer un juego en c puro, usar colores basicas,se sabes de alguna forma de hacer algo parecido utilisando visual studio 2010 estaria guay..mientras voy intentando algo..
Muchas gracias...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Conio en visual studio...gran duda..!!!!!

Publicado por leosan (3 intervenciones) el 02/10/2012 21:46:23
La librería de conio es "propiedad" de Borland, no se debería usar. Para obtener "colores", ya que usas VisualStudio deberías "tratar" con la API de windows. Un código de ejemplo en C++ es:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <windows.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
 
int main()
{
    HANDLE hOut;
 
    hOut = GetStdHandle(STD_OUTPUT_HANDLE);
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED);
    cout << "Red     " << flush;
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_INTENSITY);
    cout << "Red" << endl;
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN);
    cout << "Green   " << flush;
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN |
                            FOREGROUND_INTENSITY);
    cout << "Green" << endl;
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE);
    cout << "Blue    " << flush;
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE |
                            FOREGROUND_INTENSITY);
    cout << "Blue" << endl;
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN);
    cout << "Yellow  " << flush;
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN |
                            FOREGROUND_INTENSITY);
    cout << "Yellow" << endl;
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE);
    cout << "Cyan    " << flush;
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE |
                            FOREGROUND_INTENSITY);
    cout << "Cyan" << endl;
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE |
                            FOREGROUND_RED);
    cout << "Magenta " << flush;
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE |
                            FOREGROUND_RED |
                            FOREGROUND_INTENSITY);
    cout << "Magenta" << endl;
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE);
    cout << "White   " << flush;
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE |
                            FOREGROUND_INTENSITY);
    cout << "White" << endl;
 
    /*getchar ();*/
// Set text color as Yellow with white background.
SetConsoleTextAttribute(
    GetStdHandle( STD_OUTPUT_HANDLE ),
    FOREGROUND_INTENSITY              | // Set Text color
    FOREGROUND_RED | FOREGROUND_GREEN | // Text color as Yellow.
    BACKGROUND_INTENSITY              | // Set Background color
    BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE ); // White Bg
    return 0;
}

Saludos!.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Conio en visual studio...gran duda..!!!!!

Publicado por leosan (3 intervenciones) el 02/10/2012 21:55:12
O en C:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <windows.h>
#include <stdio.h>
#include<stdlib.h>
 
int main()
{
    HANDLE hOut;
 
    hOut = GetStdHandle(STD_OUTPUT_HANDLE);
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED);
    printf ("Red     \n");
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_INTENSITY);
    printf ("Red\n" );
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN);
    printf ("Green   \n");
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN |
                            FOREGROUND_INTENSITY);
    printf ("Green\n");
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE);
    printf ("Blue    \n");
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE |
                            FOREGROUND_INTENSITY);
    printf ("Blue\n");
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN);
    printf ("Yellow  \n");
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN |
                            FOREGROUND_INTENSITY);
    printf ("Yellow\n");
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE);
    printf ("Cyan    \n");
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE |
                            FOREGROUND_INTENSITY);
    printf ("Cyan\n");
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE |
                            FOREGROUND_RED);
    printf ("Magenta \n");
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_BLUE |
                            FOREGROUND_RED |
                            FOREGROUND_INTENSITY);
    printf ("Magenta\n");
 
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE);
    printf ("White   \n");
    SetConsoleTextAttribute(hOut,
                            FOREGROUND_RED |
                            FOREGROUND_GREEN |
                            FOREGROUND_BLUE |
                            FOREGROUND_INTENSITY);
    printf ("White\n");
 
 
// Set text color as Yellow with white background.
   /* SetConsoleTextAttribute(
    GetStdHandle( STD_OUTPUT_HANDLE ),
    FOREGROUND_INTENSITY              | // Set Text color
    FOREGROUND_RED | FOREGROUND_GREEN | // Text color as Yellow.
    BACKGROUND_INTENSITY              | // Set Background color
    BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE ); // White Bg*/
    return 0;
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar