#include #include #include #include #include #include #include #include #include #include<\om\window\mouse.h> //#include<\om\solid.cpp> static int it,it1; static int count; class shape { char *tt1,*tt2; int mx[200],my[200],dx[200],dy[200]; int mx1[200],my1[200],dx1[200],dy1[200]; int x,y,button; char n[5]; Mouse mouse; char *pass; char *dname[320]; public: shape() { } void drive(); void draw(int ,int ,int ,int,int ); void search(int,int); void showDrive(char *); void directory(int,int,char*); void click(); void search2(int,int); }; void shape::drive() { int x1,y1,x2,y2; x1=20; x2=70; y1=50; y2=100;
for(int i=2;i<=8;i++) { setdisk(i); if(i!=getdisk()) { // cout<<"NO derive Avilable"< } else { int tt; draw(x1,y1,x2,y2,i); x1=x2+40; x2=x1+50; //cout<<"Drive Avilable"<} } setdisk(2); } /*void set(int x1,int y1,int x2,int y2) { for(int i=x1;idraw(x1,y1,x2,y2,100); } */ void shape::draw(int x1,int y1,int x2,int y2,int tt) { //itoa(tt,tt1,10); //strcpy(tt2,tt1); mx[it]=x1; my[it]=y1; dx[it]=x2; dy[it]=y2;
if(tt==2) { strcpy(tt2,"C"); n[it]='C'; } else if(tt==3) { strcpy(tt2,"D"); n[it]='D'; } else if(tt==4) { strcpy(tt2,"E"); n[it]='E'; } else if(tt==5) { strcpy(tt2,"F"); n[it]='F'; } rectangle(x1,y1,x2,y2); outtextxy(x1+10,y2+5,tt2); it=it+1; } void shape::search(int moux,int mouy) { char *argv[30]; char tt3[30]; for(int j=0;j<=it;j++) { if(moux>=mx[j]&&moux<=dx[j]&&mouy>=my[j]&&mouy<=dy[j]) { clearviewport(); if(n[j]=='C') strcpy(pass,"C:\\"); else if(n[j]=='D') strcpy(pass,"D:\\"); else if(n[j]=='E') strcpy(pass,"E:\\"); else if(n[j]=='F') strcpy(pass,"F:\\"); cleardevice(); showDrive(pass); cout<click(); //break; } }
} void shape::search2(int moux,int mouy) { for(int j=0;j<=count;j++) { if(moux>=mx[j]&&moux<=dx[j]&&mouy>=my[j]&&mouy<=dy[j]) { strcat(pass,dname[j]); showDrive(pass); } }
} void shape::click() { while(!kbhit()) { mouse.getmouse(&x,&y,&button); if(button&1==1) { search2(x,y); break; } } } void shape::showDrive(char *get) { cleardevice(); DIR *dir; struct dirent *ent; int x=20,y=50; int maxx,maxy; count=0; maxx=getmaxx(); //maxy=getmaxy(); //dir=opendir(get); cout<char *temp; while((ent=readdir(dir))!=NULL) { strcpy(dname[count],ent->d_name); directory(x,y,dname[count]); count++; x=x+80; if(x>maxx-20) { x=20; y=y+90; } } } void shape::directory(int x1,int y1,char *name) { mx1[count]=x1; my1[count]=y1; dx1[count]=x1+20; dy1[count]=y1+20; //rectangle(x1,y1,x2,y2); //outtextxy(x1,y2+5,tt2); it=it+1;
rectangle(x1,y1,x1+50,y1+50); outtextxy(x1,y1+70,name); } /*void main() { clrscr(); setdisk(2); int disk1,x1,y1,x2,y2; int gd=DETECT,gm; int but,mx,my; initgraph(&gd,&gm,"C:\\tc\\bgi"); shape sp1; Mouse mo1; sp1.drive();
while(!kbhit()) { mo1.getmouse(&but,&mx,&my); if(but&1==1) { sp1.search(mx,my); //break; } } //getch(); closegraph(); restorecrtmode(); } */
|
No feedbacks found. Be the first to respond and make money from revenue sharing program.
|