Quá trình hình thành quy trình truyền dẫn thông tin di động tần số thông qua quá trình giao tiếp CDMA p8 pot - Pdf 20

LUAÂÄN VAÊN TOÁT NGHIEÄ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 <conio.h>
#include <graphics.h>
//#include <STDLIB.H>
#include <COMPLEX.H>

#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;

//
#include <CONIO.H>
#include <STDIO.H>
void MouseRead(LPEVENT lpEvent)
// Tra ve bien co nhan duoc tu chuot : Nut trai hay phai duoc an
{
LUAÂÄN VAÊN TOÁT NGHIEÄP

79

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;
//

//if((abs(CurEvent.Posx-oldEvent.Posx))<=10&&abs(CurEvent.Posy-
oldEvent.Posy)<=10)
{
{
return 1;
}
}
else
return 0;
}
else return 0;
}
//
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&&(!kbhit());i++)
{
setcolor(color2);//WHITE);
line(x,y,x+w,y);


X.CLASS SCREEN.H
#if !defined(__SCREEN_H__)
#define __SCREEN_H__ #define BORDERSIZE 3
#define TRUE 1
#define FALSE 0
#define DEMODELAY 0

// Dinh nghia cac kieu du lieu
typedef struct tagRECT{
int left, top, right, bottom ;
}RECT;
typedef RECT far *LPRECT;

typedef struct tagWINDOW {
char sCaption[80]; /*Window's caption*/
RECT rWinRect; /*Rectangle in which window is located*/
LUAÂÄN VAÊN TOÁT NGHIEÄP

81

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;

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();
LUAÂÄN VAÊN TOÁT NGHIEÄP

82

MainWindow.rSys.left = BORDERSIZE;
MainWindow.rSys.top = BORDERSIZE;
MainWindow.rSys.right = MainWindow.rSys.left+T_SIZE;
MainWindow.rSys.bottom= MainWindow.rSys.top+T_SIZE;

// Gan gia tri cho rTitleBar - H.C.nhat chua thong tin thanh
tieu de
MainWindow.rTitleBar.left =
BORDERSIZE+1;//MainWindow.rSys.right+1;
MainWindow.rTitleBar.top = BORDERSIZE+1;
MainWindow.rTitleBar.right = WinWidth-BORDERSIZE-1;
MainWindow.rTitleBar.bottom= MainWindow.rSys.top+T_SIZE;

// Gan gia tri cho rMenuBar - H.C.nhat chua thong tin menu
// Gan gia tri cho rMessage -
H.C.nhat chua thong tin cua cac
//thong bao
MainWindow.rMessage.left = BORDERSIZE+1;
MainWindow.rMessage.right = WinWidth-BORDERSIZE-2;
MainWindow.rMessage.top = WinHeight-(BORDERSIZE+2)-MSG_SIZE;
MainWindow.rMessage.bottom= MainWindow.rMessage.top+MSG_SIZE;

// Gan gia tri cho rViewPort - H.C.nhat chua thong tin ve vung
lam viec
// thuc su cua cua so
MainWindow.rViewPort.left = BORDERSIZE+1;
MainWindow.rViewPort.top =
MainWindow.rTitleBar.bottom+2;//MainWindow.rMenuBar.bottom+2;
MainWindow.rViewPort.right = WinWidth-BORDERSIZE-2;
MainWindow.rViewPort.bottom= MainWindow.rMessage.top-2;

MainWindow.rMessage.bottom-H_CHAR-5, Msg);
// tra ve trang thai cu
setfillstyle(FillInfo.pattern, FillInfo.color);
setcolor(OldColor);
setviewport(vp.left,vp.top, vp.right, vp.bottom, 1);
}
//
void DrawScreenBorder(int left, int top, int right, int bottom)
// Ve duong vien cho mot hinh chu nhat co toa do (left, top), (right,
bottom)
{
setfillstyle(SOLID_FILL, COLOR_BORDER);
bar(left, top, right, top+BORDERSIZE);
bar(left, bottom, right, bottom-BORDERSIZE);
bar(left, top, left+BORDERSIZE, bottom);
bar(right-BORDERSIZE, top, right, bottom);
setcolor(BLACK);
rectangle(left, top, right, bottom);
rectangle(left+BORDERSIZE, top+BORDERSIZE,
right-BORDERSIZE, bottom-BORDERSIZE);
}
//
#include <dos.h>
void InitScreen(void)
// Ve cac thanh phan cua cua so
{
int x, y;
int WinWidth, WinHeight;
struct viewporttype vp;


(MainWindow.rSys.top+MainWindow.rSys.bottom)/2-1,
(MainWindow.rSys.left+MainWindow.rSys.right)/2+5,
(MainWindow.rSys.top+MainWindow.rSys.bottom)/2+1);
delay(DEMODELAY);
*/ // Ve Menu
// bar(MainWindow.rMenuBar.left, MainWindow.rMenuBar.top,
// MainWindow.rMenuBar.right, MainWindow.rMenuBar.bottom);
// outtextxy(MainWindow.rMenuBar.left+8, MainWindow.rMenuBar.bottom-
13,
// "Menu of Program is here");
// delay(DEMODELAY);
// Ve thanh chua thong bao
bar(MainWindow.rMessage.left, MainWindow.rMessage.top,
MainWindow.rMessage.right, MainWindow.rMessage.bottom);
OutMessage("Welcome to Demo Window Program");
delay(DEMODELAY);
// Ve vung lam viec
setfillstyle(SOLID_FILL, COLOR_WINDOW);
bar(MainWindow.rViewPort.left, MainWindow.rViewPort.top,
MainWindow.rViewPort.right, MainWindow.rViewPort.bottom);
setcolor(BLACK);
rectangle(MainWindow.rViewPort.left-1, MainWindow.rViewPort.top,
MainWindow.rViewPort.right+1, MainWindow.rViewPort.bottom);
delay(DEMODELAY);
// Dat lai viewport la rViewPort
setviewport(MainWindow.rViewPort.left, MainWindow.rViewPort.top,
MainWindow.rViewPort.right, MainWindow.rViewPort.bottom,
1);
}
//

}
//
void Set2Pixel(int Ox, int Oy, int x, int y)
{
putpixel(Ox+x, Oy-y, LineColor);
putpixel(Ox-x, Oy-y, LineColor);
}
//
void Set2PixelHor(int Ox, int Oy, int x, int y)
{
putpixel(Ox+x, Oy-y, LineColor);
putpixel(Ox+x, Oy+y, LineColor);
}
//
void ClearViewPort(void)
{
struct fillsettingstype FillInfo;

// luu thong tin cu
getfillsettings(&FillInfo);
setfillstyle(SOLID_FILL, COLOR_WINDOW);
bar(0, 0, VP_WIDTH, VP_HEIGHT);
setfillstyle(FillInfo.pattern, FillInfo.color);
DrawSysCoordinates();
} */
// End of SCREEN.C
//
#include <alloc.h>
int OutError(char *s)
{

{
lpEvent=GetEvent();
if(kbhit())
{
if((event=getch())==13)
{
CompleteOk:
HideMouse();
putimage(200,150,buf,COPY_PUT);
ShowMouse();
farfree(buf);
return OK;
}
if(event==27)
{
CompleteCancel:
HideMouse();
putimage(200,150,buf,COPY_PUT);
ShowMouse();
farfree(buf);
return 0;
}
if(event==9)
{
OK=!OK;
Cancel:
if(OK==0)
{
HideMouse();
setfillstyle(SOLID_FILL,BLUE);

OK=1;
goto Ok;
}
LUAÂÄN VAÊN TOÁT NGHIEÄP

87

}
else
flushall();
}
if(lpEvent->Msg==1)
{
if(lpEvent->Posx>=Cx1&&lpEvent->Posx<=Cx2&&lpEvent-
>Posy>=Cy1&&lpEvent->Posy<=Cy2)
{
OK=0;
goto CompleteCancel;
}
if(lpEvent->Posx>=Ox1&&lpEvent->Posx<=Ox2&&lpEvent-
>Posy>=Oy1&&lpEvent->Posy<=Oy2)
{
OK=1;
goto CompleteOk;
}
}
ShowMouse();
}while(1);
}



char *SEND::CatFile(char St_add[],char End_add[],char InFile[])
{
char
KyTu_Hex[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E
','F','a','b','c','d','e','f'};
int
Gtri_Dec[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,10,11,12,13,14,15};

unsigned int i,DemSpace;
LUAÂÄN VAÊN TOÁT NGHIEÄP

88

unsigned int Value1=0,Value2=0;

char FindPos,FindValue;
int Thoigian=0;

FILE *f,*f1;
char t,t1,t2,t3,t4;
// char St_add[]="0000 Hex",End_add[]="000F Hex";
int end_line;

strcpy(OutFile,InFile);
i=strlen(OutFile);
do
{
OutFile[i]='\0';
}while(OutFile[ i]!='.');

do
{
fread(&t2,1,1,f);
Value1++;
DemSpace=0;
do
{
fread(&t,1,1,f);
DemSpace++;
}while(t==' '&&DemSpace<3);//con la lenh hoac dia chi hay da
cham dut mot lenh if(DemSpace>=2)//la ma lenh hoac da ket thuc mot dong lenh
{
fwrite(&t1,1,1,f1);
fwrite(&t2,1,1,f1);


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status