#include #include #include #include #include #include #include // Para getch(); #include // Para outtextxy(...); y cleardevice(...); #include "..\..\jd_lib\make_bot.h" // Fuciones de MAKE_BOTON #include "cd_icons.h" #include "cd_error.h" #define DOS 1 #define WINDOWS 2 void Init_EXE(int CurrIcon); char *current_directory(char *path); extern void Inicializa_Dibujo(void); extern void Inicializa_Iconos(void); extern void Coloca_Iconos_Dos_Windows(void); extern char far *Icono; // 18 extern unsigned char *P_Raton1, *P_Raton2, *P_Raton3, *P_Raton4; extern void *Pantalla; void InicializaSVGA(void); extern char dac[256*3]; extern "C" void APAGA_PANTALLA(char *); extern "C" void ENCIENDE_PANTALLA(char *); extern void Menu_de_Edicion(void); extern void Coloca_Iconos(int Start_Icon); void Init_EXE(int CurrIcon){ int ok = 0, exe = 0; char curdir[80]; /* void far *Mascara; if( (Mascara = farmalloc(imagesize(118, 160, 521, 335) ) ) == NULL) { closegraph(); cprintf("\n\rSALIENDO"); cprintf("\n\rImposible encontrar %dKbytes en el Heap", ok); exit(SIN_MEMORIA); } getimage(118, 159, 521, 335, Mascara); */ Imprime_Estaticos(10, "cd_out.img"); // Imprime botones estaticos 'Seccion 4' Imprime_Secuencia(3); // Imprime secuencia 1. Imprime_Estaticos(11, "cd_out.img"); // Imprime textos estaticos 'Seccion 5' while(!ok){ // Bucle infinito switch( Comprueba_Secuencia( 3 ) ) { // Iniciamos comprobacion de 2¦ sec case 0: // No se pulso ningun BOTON // Pero el raton fue presionado en // algun sitio... break; case -2: // Hay una tecla normal en BUFFER switch( getch() ) { // La utilizamos // Intro ( ACEPTAR ) case 13: exe = 1; ok = 1; break; // ESC ( CANCELAR ) case 14: exe = 0; ok = 1; break; default: break; } break; case -1: // Hay una tecla especial en BUFFER getch(); // La eliminamos break; // Boton Aceptar case 1: exe = 1; ok = 1; break; // Boton Cancelar case 2: exe = 0; ok = 1; break; default: while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER break; } } /* putimage(118, 160, Mascara, COPY_PUT); farfree(Mascara); */ if ( exe == 1 ) { /// Liberamos la memoria asignada para al DRIVER gr fico... current_directory(curdir); APAGA_PANTALLA(dac); closegraph(); Libera_Memoria(); free(P_Raton1); free(P_Raton2); free(P_Raton3); free(P_Raton4); free(Pantalla); farfree(Icono); closegraph(); cprintf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n\r"); cprintf("³ JD & CD_OUT ³\n\r"); cprintf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n\r"); cprintf("EJECUTANDO PROGRAMA: []\n\r"); /* C O M I E N Z A L A E J E C U C I O N D E L P R O G R A M A */ if ( system( getenv( "COMSPEC") ) != 0 ) { printf("\n\nImposible salir a MS-DOS\n\n"); sleep(5); } clrscr(); cprintf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n\r"); cprintf("³ JD & CD_OUT ³\n\r"); cprintf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n\r"); cprintf("Regresando a CD_OUT...\n\r"); //// Recargamos el Programa... chdir(curdir); // Refresamos a nuestro directorio // de origen InicializaSVGA(); // Reinicializamos la SVGA APAGA_PANTALLA(dac); // Apagamos la Pantalla Inicializa_Dibujo(); // Inicializamos un nuevo dibujo if( carga_botones("cd_out.img") // Recarga botones del fichero "CD_out.img" != OK ) { Imprime_Estaticos( 112, "cd_out.img"); Espera_Tecla_o_Raton(); closegraph(); cprintf("\n\rError en la CARGA DE BOTONES"); exit(112); /* SALE CON UN MENSAJE GRµFICO */ } Imprime_Estaticos( 1, "cd_out.img"); // Imprime botones estaticos 'Seccion 1' Imprime_Secuencia(1); // Imprime secuencia 1. Imprime_Estaticos( 2, "cd_out.img"); // Imprime botones estaticos 'Seccion 2' // para los textos Inicializa_Iconos(); Coloca_Iconos_Dos_Windows(); Coloca_Iconos(CurrIcon); ENCIENDE_PANTALLA(dac); if ( (Pantalla = malloc( imagesize(0, 0, 20, 20) )) == NULL ) { Imprime_Estaticos( SIN_CVN, "cd_out.img"); Espera_Tecla_o_Raton(); closegraph(); cprintf("\n\rError en la asignaci¢n de memoria para la mascara del raton"); exit(2); } inicializa_raton_grafico( 0, 0, 619, 460); True_Push = ON; // Activa el TRUE PUSH ( PRESION REAL ) } } char *current_directory(char *path) { strcpy(path, "X:\\"); /* fill string with form of response: X:\ */ path[0] = 'A' + getdisk(); /* replace X with current drive letter */ getcurdir(0, path+3); /* fill rest of string with current directory */ return(path); }