#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<dos.h>
void initgraphe();
void souris();
void msg(int);
void initgraphe()
{int pg=DETECT,mg;
clrscr();
initgraph(&pg,&mg,"..\\bgi");
setbkcolor(9);}
void main()
{
initgraphe();setbkcolor(1); setfillstyle(1,
;
bar(260,100,360,120);
outtextxy(280,107,"click me");
souris();
}
void souris()
{
_AX=0; geninterrupt(0x33); //initialisation
_AX=7; // nø de l'interruption
_CX=5; _DX=634; // Xmin & Xmax
geninterrupt(0x33);
_AX=8; // nø de l'interruption
_CX=5; _DX=475; // Ymin & Ymax
geninterrupt(0x33);
_AX=1; geninterrupt(0x33); //Affichage du curseur
_AX=4; //nø de l'interruption
_CX=78; //X initiale du curseur
_DX=100; //Y initiale du curseur
geninterrupt(0x33);
do
{
do
{ _AX=3; //‚coute permanente d'un ‚ventuel click
geninterrupt(0x33);
}while(_BX==0);
if(_BX==1) //click sur le boutton gauche
{
if((260<_CX&&_CX<360)&&(100<_DX&&_DX<120)) {/*fontion ici*/closegraph();exit(0);}
}
}while(1);
}
void msg(int tmp)
{ setbkcolor(0);setfillstyle(1,4);
bar(130,200,500,250);
outtextxy(165,210,"Une erreur g‚n‚rale s'est produite");
outtextxy(145,230,"arrˆt du systŠme dans quelques secondes ...");
delay(tmp); setbkcolor(3); nosound();
setfillstyle(1,9);
bar(130,200,500,250);
outtextxy(145,230,"");
outtextxy(145,210,"Eviter de clicker n'importe o— Mr Programmer !!!!");
outtextxy(165,230,"c'‚tait une blague !bonne programmation");
delay(tmp-1000);
}
void graph()
{
int gdriver=DETECT , gmode, errorcode;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
}