Đang tải... (xem toàn văn)
Tham khảo tài liệu ''quá trình hình thành tư liệu hướng dẫn cách chấm mạch eprom trong kit vi xử lý p8'', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
LUÂÄN VĂN TỐT NGHIỆP 78 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 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 { LUÂÄN VĂN TỐ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 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))PosxPosy>=Cy1&&lpEvent->PosyPosx>=Ox1&&lpEvent->PosxPosy>=Oy1&&lpEvent->Posy=0;FindPos ) for(FindValue=0;FindValue=0;FindPos ) for(FindValue=0;FindValue