Ciao, sto facendo un programma che prevede un tastierino numerico fatto con la libreria graphics.h... il problema e' che quando si apre la finestra che che ho creato con initwindow(); viene segnalato che il programma non risponde. chi mi puo dare una mano?? il codice lo trovate qui sotto.
un avvertimento, se qualche bel gentil'uomo decidesse di aiutarmi e provare il codice ricordo che va prima installata la libreria graphics.h e poi creato un progretto non un singolo file sorgente... grazie
#include <graphics.h>
#include <dos.h>
#include <iostream>
#include <windows.h>
int x1a = 50, x1b = 150, x2a = 250, x2b = 350, x3a = 450,x3b = 550,x4a = 50 ,x4b = 150,x5a = 250, x5b = 350 ,x6a = 450 ,x6b = 550,x7a = 50 ,x7b = 150 ,x8a = 250 ,x8b = 350, x9a = 450, x9b = 550, x0a = 50 ,x0b = 150, xca = 250, xcb = 350, xia = 450, xib = 550;
int y1a = 50, y1b = 150, y2a = 50, y2b = 150, y3a = 50 ,y3b = 150,y4a = 250,y4b = 350,y5a = 250 ,y5b = 350 ,y6a = 250 ,y6b = 350,y7a = 450,y7b = 550, y8a = 450, y8b = 550, y9a = 450, y9b = 550, y0a = 650, y0b = 750, yca = 650, ycb = 750, yia = 650, yib = 750;
const int d = 0;
const int dy = 0;
int count =0;
const int s = 0;
const int sy = 0;
int pin;
//int gd = DETECT, gm;
int main()
{
//initgraph(&gd, &gm, "");
initwindow(600,800);
rectangle(x1a-s,y1a-sy,x1b-s,y1b-sy);
settextstyle(9,0,8);
outtextxy(72,55,"1");
rectangle(x2a-s,y2a-sy,x2b-s,y2b-sy);
outtextxy(272,55,"2");
rectangle(x3a-s,y3a-sy,x3b-s,y3b-sy);
outtextxy(472,55,"3");
rectangle(x4a-s,y4a-sy,x4b-s,y4b-sy);
outtextxy(72,255,"4");
rectangle(x5a-s,y5a-sy,x5b-s,y5b-sy);
outtextxy(272,255,"5");
rectangle(x6a-s,y6a-sy,x6b-s,y6b-sy);
outtextxy(472,255,"6");
rectangle(x7a-s,y7a-sy,x7b-s,y7b-sy);
outtextxy(72,455,"7");
rectangle(x8a-s,y8a-sy,x8b-s,y8b-sy);
outtextxy(272,455,"8");
rectangle(x9a-s,y9a-sy,x9b-s,y9b-sy);
outtextxy(472,455,"9");
rectangle(x0a-s,y0a-sy,x0b-s,y0b-sy);
outtextxy(72,655,"0");
rectangle(xca-s,yca-sy,xcb-s,ycb-sy);
outtextxy(264,655,"C");
rectangle(xia-s,yia-sy,xib-s,yib-sy);
outtextxy(468,655,"E");
while(true){
POINT mousePos;
GetCursorPos(&mousePos);
if((mousePos.x>x1a-s && mousePos.y>y1a-s && mousePos.x<x1b-s && mousePos.y<y1b-s )&& WM_LBUTTONDOWN) pin = 1;
if((mousePos.x>x2a-s && mousePos.y>y2a-s && mousePos.x<x2b-s && mousePos.y<y2b-s)) pin = 2;
if((mousePos.x>x3a-s && mousePos.y>y3a-s && mousePos.x<x3b-s && mousePos.y<y3b-s)) pin = 3;
if((mousePos.x>x4a-s && mousePos.y>y4a-s && mousePos.x<x4b-s && mousePos.y<y4b-s)) pin = 4;
if((mousePos.x>x5a-s && mousePos.y>y5a-s && mousePos.x<x5b-s && mousePos.y<y5b-s)) pin = 5;
if((mousePos.x>x6a-s && mousePos.y>y6a-s && mousePos.x<x6b-s && mousePos.y<y6b-s)) pin = 6;
if((mousePos.x>x7a-s && mousePos.y>y7a-s && mousePos.x<x7b-s && mousePos.y<y7b-s)) pin = 7;
if((mousePos.x>x8a-s && mousePos.y>y8a-s && mousePos.x<x8b-s && mousePos.y<y8b-s)) pin = 8;
if((mousePos.x>x9a-s && mousePos.y>y9a-s && mousePos.x<x9b-s && mousePos.y<y9b-s)) pin = 9;
if((mousePos.x>x0a-s && mousePos.y>y0a-s && mousePos.x<x0b-s && mousePos.y<y0b-s)) pin = 0;
if((mousePos.x>xca-s && mousePos.y>yca-s && mousePos.x<xcb-s && mousePos.y<ycb-s)) pin = 99;
if((mousePos.x>xia-s && mousePos.y>yia-s && mousePos.x<xib-s && mousePos.y<yib-s)) pin = 99;
printf("\n%d",pin);
//printf("%d",mousePos.x);
// Mouse y Position = mousePos.y
//Sleep(20);
}
//getch();
//closegraph();
getch();
return 0;
}