intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Giáo trình hình thành quy trình điều khiển thiết bị bán dẫn chứa các mạch logic điện tử p8

Chia sẻ: Sdfasf Dsgfds | Ngày: | Loại File: PDF | Số trang:10

52
lượt xem
3
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tham khảo tài liệu 'giáo trình hình thành quy trình điều khiển thiết bị bán dẫn chứa các mạch logic điện tử p8', kỹ thuật - công nghệ, điện - điện tử phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả

Chủ đề:
Lưu

Nội dung Text: Giáo trình hình thành quy trình điều khiển thiết bị bán dẫn chứa các mạch logic điện tử p8

  1. . 72 LUAÂÄN VAÊN TOÁT NGHIEÄP if((int)Lis[0].ff_attrib!=16) dem-=1; while (!done)//nhap ten file vao mang cau truc FF { dem++; done = findnext(&FF); if(!done) Lis[dem]=FF; if((int)Lis[dem].ff_attrib!=16) dem-=1; } dem+=1; int NumDir=dem; done=findfirst(ftype,&FF,FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCH); for(int j=0;j
  2. . 73 LUAÂÄN VAÊN TOÁT NGHIEÄP case 81://page down if(ppp++ >12)//17) ppp=0; else goto MouseDown; case 80: // mui ten xuong nhanphim=1; MouseDown: HideMouse(); if(Dem
  3. . 74 LUAÂÄN VAÊN TOÁT NGHIEÄP goto nutCancel; } }//if(kbhit()) /////////////////////////////////// xet mouse if(lpEvent->Msg==1)//neu nhan phim trai chuot { if(lpEvent->Posx>=x51&&lpEvent->PosxPosy>=y51&&lpEvent->PosyPath();//lay Path vao bien S cua TEXTBOX Box2->GetS(ftype); putimage(x11,y11,buf,COPY_PUT); farfree(buf); ShowMouse(); return 2; } if(lpEvent->Posx>=x71&&lpEvent->PosxPosy>=y71&&lpEvent->Posy=x81&&lpEvent->PosxPosy>=y81&&lpEvent->Posy
  4. . 75 LUAÂÄN VAÊN TOÁT NGHIEÄP {//choose disk HideMouse(); setcolor(BLACK); line(x81,y81,x82,y81); line(x81,y81,x81,y82); line(x81+1,y81-1,x81+1,y82-1); char OldDName=*DName; CheckChooseDisk(DiskName,DName,lpEvent,x82,y82); if(OldDName!=*DName) { putimage(x11,y11,buf,COPY_PUT); farfree(buf); return 2; } setcolor(WHITE); line(x81,y81,x82,y81); line(x81,y81,x81,y82); line(x81+1,y81-1,x81+1,y82-1); ShowMouse(); } for(j=0;j=lpEvent->Posx) if((tempy1+j*14)Posy&&(tempy2+j*14)>=lpEvent- >Posy) { Arrowkey: HideMouse(); setfillstyle(SOLID_FILL,WHITE);//MAGENTA); bar(oldx1,oldy1,oldx2,oldy2); setcolor(BLACK);//LIGHTGREEN); outtextxy(x21+8,oldy1+3,Lis[Dem+over].ff_name); setfillstyle(SOLID_FILL,BLUE); oldx1=tempx1, oldy1=tempy1+j*14,oldx2=tempx2,oldy2=tempy2+j*14; bar(oldx1,oldy1,oldx2,oldy2); setcolor(YELLOW); outtextxy(x21+8,oldy1+3,Lis[j+over].ff_name); _dos_getfileattr(Lis[j+over].ff_name,attrib); strcpy(s,Lis[j+over].ff_name); if(strcmp(s,".")==0) strcpy(s,"\\"); Dem=j; End: Kiemtra=1;//bao hieu co nhan vao list } if(lpEvent->Msg==1&&(j==15)&&tempx1Posx&&tempx2>=lpEvent->Posx&&(tempy1+j*14)Posy&&(tempy2+j*14)>=lpEvent->Posy) //truong hop vet tro file o cuoi bang list va nhap chuot ngay ben duoi vet tro { lpEvent->Posx=x11; lpEvent->Posy=y11; delay(50); goto MouseDown; } if(lpEvent->Msg==1&&(j==15)&&tempx1Posx&&tempx2>=lpEvent->Posx&&(tempy1-14)Posy&&(tempy2- 14)>=lpEvent->Posy)
  5. . 76 LUAÂÄN VAÊN TOÁT NGHIEÄP //truong hop vet tro file o dau bang list va nhap chuot ngay ben tren vet tro { lpEvent->Posx=x11; lpEvent->Posy=y11; delay(50); goto MouseUp; } if(lpEvent->Msg==1&&x31Posx&&y31Posy&&x32>=lpEvent->Posx&&y32>=lpEvent->Posy) nutOK: { HideMouse(); putimage(x11,y11,buf,COPY_PUT); farfree(buf); if(Kiemtra!=1) strcpy(s,Lis[0].ff_name); if(strcmp(s,".")==0) { strcpy(s,"\\"); *attrib=16; } if(*attrib==16) { chdir(s); return 2; } Show(); ShowMouse(); OutMessage("Click OK to send file."); return 1 ;//bao da co chon file } if(lpEvent->Msg==1&&x41Posx&&y41Posy&&x42>=lpEvent->Posx&&y42>=lpEvent->Posy) nutCancel: { HideMouse(); putimage(x11,y11,buf,COPY_PUT); farfree(buf); Cancel: Show(); ShowMouse(); OutMessage("Click mouse to chose action"); return 0; } } if(lpEvent->Msg==2) { delay(100); goto nutOK; } }while(1); } //--------------------------------------------------------- VIII. CLASS MOUSE.H #if !defined(__MOUSE_H__) #define __MOUSE_H__ #include
  6. . LUAÂÄN VAÊN TOÁT NGHIEÄP 77 #include "screen.h" #define INT_MOUSE 0x33 #define M_LEFT 0x01 /* set if LEFT press */ #define M_RIGHT 0x02 /* set if RIGHT press */ #define M_CENTER 0x04 /* set if CENTER press */ #define M_CHANGE 0x08 /* set if mouse status is changed */ /* -- Keyboard coding bits -- */ #define KEY_NULL 0x0 #define ESC 0x1B #define ENTER 0x0D #define TAB '\t' #define INS 0xD2 #define DEL 0xD3 #define BACKSPACE 0x8 #define HOME 0xC7 #define END 0xCF #define PAGE_UP 0xC9 #define PAGE_DOWN 0xD1 /* -- Function's keys -- */ #define F1 0xBB #define F2 0xBC #define F3 0xBD #define F4 0xBE #define F5 0xBF #define F6 0xC0 #define F7 0xC1 #define F8 0xC2 #define F9 0xC3 #define F10 0xC4 #define PLUS 0x2B #define MINUS 0x2D #define SPACEBAR 0x20 #define SHIFT_TAB 0x8F #define CTRL_C 0x3 //struct time; typedef struct tagEVENT{ int Msg; int Posx, Posy; // toa do xay ra bien co chuot struct time *t; } EVENT; typedef EVENT far *LPEVENT; // Khai bao cac ham toan cuc extern void SetMouseRange(LPRECT);//LPRECT: xem SCREEN.H extern int InitMouse(LPRECT); extern void ShowMouse(void); extern void HideMouse(void); extern void MouseRead(LPEVENT); extern LPEVENT GetEvent(void); extern void DeviceRelease(int); //extern void ButtonPressed(int, LPEVENT); extern void ResetEvent(LPEVENT); //extern void MoveMouse(int x,int y);//tri extern void MouseText(int x,int y,int color1, int color2);//,char s[]); //extern int GetKey(void);
  7. . 78 LUAÂÄN VAÊN TOÁT NGHIEÄP extern int GetMtx(); extern int GetMty(); //extern EVENT OldEvent(); extern int Double(LPEVENT); #endif // End of MOUSE.H IX.MODULE MOUSE.CPP #include #include //#include #include #include "mouse.h" void SetMouseRange(LPRECT lpRect) // Dat vung di chuyen cho chuot { _AX = 0x07;//ham 07 cua ngat 33 de dinh gioi han di chuyen ngang _CX = lpRect->left; _DX = lpRect->right; geninterrupt(INT_MOUSE);//INT_MOUSE=0x33:ngat 33 _AX = 0x08;//ham 08 cua ngat 33 dinh gioi han di chuyen doc cho con tro _CX = lpRect->top; _DX = lpRect->bottom; geninterrupt(INT_MOUSE); } //--------------------------------------------------------- int InitMouse(LPRECT lpRect) // Khoi dong chuot { int ax; _AX = 0; geninterrupt(INT_MOUSE); ax = _AX; if (ax == 0) return FALSE; SetMouseRange(lpRect); return TRUE; } //--------------------------------------------------------- void ShowMouse(void) // Hien thi chuot { _AX = 1; geninterrupt(INT_MOUSE); } //--------------------------------------------------------- void HideMouse(void) // Dau chuot { _AX = 2; geninterrupt(INT_MOUSE); } //--------------------------------------------------------- #include #include void MouseRead(LPEVENT lpEvent) // Tra ve bien co nhan duoc tu chuot : Nut trai hay phai duoc an {
  8. . 79 LUAÂÄN VAÊN TOÁT NGHIEÄP int bx; _AX = 3; geninterrupt(INT_MOUSE); bx = _BX; //cx = _CX; //dx = _DX; lpEvent->Msg = bx; lpEvent->Posx = _CX; lpEvent->Posy = _DX; gettime(lpEvent->t); } //--------------------------------------------------------- void ResetEvent(LPEVENT lpEvent) { lpEvent->Msg = 0; lpEvent->Posx = lpEvent->Posy = 0; } //--------------------------------------------------------- EVENT PrevEvent, CurEvent; //--------------------------------------------------------- LPEVENT GetEvent(void) { ResetEvent(&CurEvent); MouseRead(&CurEvent); // chuyen sang toa do ViewPort CurEvent.Posx = CurEvent.Posx-MainWindow.rViewPort.left; CurEvent.Posy = CurEvent.Posy-MainWindow.rViewPort.top; // xet trang thai chuot co thay doi hay khong if((CurEvent.Posx!=PrevEvent.Posx)&&(CurEvent.Posy!=PrevEvent.Posy)) CurEvent.Msg |= M_CHANGE; PrevEvent = CurEvent; // delay(50); return (&CurEvent); } //--------------------------------------------------------- void DeviceRelease(int Msg) { while(GetEvent()->Msg&Msg); } //--------------------------------------------------------- int Double(LPEVENT lpEvent) { if(lpEvent->Msg==1) { delay(100); ResetEvent(lpEvent); lpEvent=GetEvent(); if(lpEvent->Msg==1) //if((abs(CurEvent.Posx-oldEvent.Posx))
  9. . LUAÂÄN VAÊN TOÁT NGHIEÄP 80 void MouseText(int x,int y,int color1,int color2)//,char s[])//gia dau nhay con tro { HideMouse(); // int h=textheight(s); int w=5; int color=getcolor(); do { for(int i=0;i
  10. . 81 LUAÂÄN VAÊN TOÁT NGHIEÄP RECT rSys; /*System area of window*/ RECT rTitleBar; /*Caption area of window*/ RECT rMenuBar; /*Rectangle in which window's menu is located*/ RECT rMessage; /* Rectangle in which messages is display }WINDOWS; // Dinh nghia cac ham va bien dung toan cuc extern int Xc, Yc; // Goc toa do extern int LineColor; extern int VP_WIDTH; extern int VP_HEIGHT; extern WINDOWS MainWindow; extern void InitGraphics(void); extern void OutMessage(char *Msg); extern void InitScreen(void); extern void InitValues(char *lpCaption); extern int OutError(char *s); #endif // End of SCREEN.H XI.MODULE SCREEN.CPP #include #include #include #include #include #include "screen.h" #include "mouse.h" int T_SIZE, W_SIZE, H_SIZE, W_CHAR, H_CHAR, MSG_SIZE; int COLOR_WINDOW; int COLOR_BUTTON; int COLOR_BORDER; int COLOR_CAPTION; int COLOR_TEXT; int VP_WIDTH; int VP_HEIGHT; int Maxx, Maxy; // Maxx - Maxy of screen WINDOWS MainWindow; //int Xc, Yc; // Goc toa do //int LineColor = MAGENTA; // Mau cua duong thang can ve - Dung trong thu tuc SetPixel //--------------------------------------------------------- void InitGraphics(void) // Khoi tao che do do hoa { int grDrv=DETECT, grMode; int ErrCode; initgraph(&grDrv, &grMode, ""); ErrCode = graphresult(); if(ErrCode!= grOk) { printf("Graphics error: %s\n", grapherrormsg(ErrCode)); printf("Press any key to halt..."); getch(); exit(1); /* return with error code */ } Maxx = getmaxx();
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2