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
| void __fastcall TFourm::Execute()
{
try{
axe *p;
nagios *p2;
int i;AnsiString ip_sour;
int treecount,etat;
treecount=0;
//*********PARTIE 1***************
MessageBox(0,"Réseau A","Scan Computers",MB_OK);
for(i=1;i<=max;i++){
sour=false;first=true;
p=axelist[i];
p2=axenagios[i];
while (p!=NULL){
if (first){
etat=pinggeneral(p->ipaddress);
if (etat!=0)
{sour=true;Form1->Memo1->Lines->Add(p->ipaddress);
Form1->TreeView1->Items->Item[treecount]->ImageIndex=1;Form1->TreeView1->Refresh();
Form1->Image2->Canvas->Brush->Color=clRed; Form1->Image2->Canvas->FillRect(Rect(toScreenx(p2->pos.x),toScreeny(p2->pos.y),toScreenx(p2->pos.x)+20,toScreeny(p2->pos.y)+20));
}
else {sour=false;
}
first=false;
}
else{
if (sour){
etat=pinggeneral(p->ipaddress);
if (etat!=0)
{sour=true;Form1->Memo1->Lines->Add(p->ipaddress);
Form1->TreeView1->Items->Item[treecount]->ImageIndex=1;Form1->TreeView1->Refresh();
Form1->Image2->Canvas->Brush->Color=clRed;
Form1->Image2->Canvas->FillRect(Rect(toScreenx(p2->pos.x),toScreeny(p2->pos.y),toScreenx(p2->pos.x)+20,toScreeny(p2->pos.y)+20));
}
}
}
p=p->next;p2=p2->next;
treecount++;
}
}
//***************PARTIE 2*********************
MessageBox(0,"Réseau B","Scan Computers",MB_OK);
treecount=0;
for(i=1;i<=maxblr;i++){
if (i==1){
etat=pinggeneral(breezmax[i].Adresse);
if (etat!=0) {Form1->TreeView3->Items->Item[treecount]->ImageIndex=1;
Form1->Image2->Canvas->Brush->Color=clRed;
Form1->Image2->Canvas->FillRect(Rect(toScreenx(breezpoint[i].x),toScreeny(breezpoint[i].y),toScreenx(breezpoint[i].x)+20,toScreeny(breezpoint[i].y)+20));
}
else {i=maxblr+1;//quitter la boucle
}
}
else{
etat=pinggeneral(breezmax[i].Adresse);
if (etat!=0) {Form1->TreeView3->Items->Item[treecount]->ImageIndex=1;
Form1->Image2->Canvas->Brush->Color=clRed;
Form1->Image2->Canvas->FillRect(Rect(toScreenx(breezpoint[i].x),toScreeny(breezpoint[i].y),toScreenx(breezpoint[i].x)+20,toScreeny(breezpoint[i].y)+20));
}
}
treecount++;
}
ShowMessage("Scan terminé !!!");
//Form1->Image2->Refresh();
Form1->Image2->Picture->SaveToFile("C:\image-scannetwork.bmp");
}
catch (...){
ShowMessage("ERREUR DURANT LE SCAN");
}
} |
Partager