📄 2386demo.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <alloc.h>
#include "bbgui.h"
#include "color.h"
#include "mess.h"
#include "serCpu.h"
int c;
unsigned char far num[12];
char M_mess[15]="www.lanrry.com"; //短消息内容
unsigned char s1[]="发送中请捎候......";
unsigned char s2[]="发送完成,请退出....";
unsigned char count;
/**********************************************************************
函数名称:
功能描述:
入口参数:
返回值:
日期:
***********************************************************************/
void far Key_num(int left,int top,int width,int hight,int color,int colorBK)
{
int x0,y0;
int i,j,k=0;
unsigned char str0[1];
unsigned char str00[2]="0";
unsigned char str1[2]="a";
unsigned char str2[2]="b";
unsigned char str3[2]="c";
unsigned char str4[]="退出";
unsigned char str5[]="取消";
unsigned char str6[]="确定";
x0 = left;
y0 = top;
for(j=0;j<4;j++)
{
x0 = left;
for(i=0;i<4;i++)
{
GuiBoxFill(x0,y0,x0+width,y0+hight,colorBK);
k++;
/************************************************/
if(k<10)
{
sprintf(str0,"%d",k);
GuiString(x0+16,y0+12,str0,color,colorBK);
}
else{
switch(k)
{
case 10: GuiString(x0+16,y0+12,str00,color,colorBK); break;
case 11: GuiString(x0+16,y0+12,str1,color,colorBK); break;
case 12: GuiString(x0+16,y0+12,str2,color,colorBK); break;
case 13: GuiString(x0+16,y0+12,str3,color,colorBK); break;
case 14: GuiString(x0+4,y0+12,str4,color,colorBK); break;
case 15: GuiString(x0+4,y0+12,str5,color,colorBK); break;
case 16: GuiString(x0+4,y0+12,str6,color,colorBK); break;
default : break;
}
/****************************************************/
}
x0= x0+width+2;
}
y0= y0+hight+2;
}
}
int Get_pot(int *x,int *y)
{
union REGS regs;
regs.x.ax = 0x03; //调用3号功能
int86(0x33,®s,®s); //dos bios 调用
*x = regs.x.cx; //取得坐标值
*y = regs.x.dx;
return regs.x.bx;
}
int Get_mouse(int left,int top,int width,int hight)
{
int x0,y0,x1,y1 = 0;
int i,j;
x0 = left;
y0 = top;
if(Get_pot(&x1,&y1) == 1)
{
for(j = 0;j<4;j++)
{
y0 = top+j*(2+hight);
for(i = 0;i<4;i++)
{
x0= left+i*(2+width);
if((x1>=x0)&&(x1<=(x0+width))&&(y1>=y0)&&(y1<=(y0+hight)))
{
return (4*j+i+1);
}
}
}
}
return -1;
}
/**********************************************************************
函数名称:
功能描述:
入口参数:
返回值:
日期:
***********************************************************************/
void far Get_num(void)
{
if (count <11)
{
if(c<10)
{
num[count+1]='\0';
num[count++]=c+48;
GuiString(100,20,num,0x00,0x02);
}
if(c == 10)
{
num[count+1]='\0';
num[count++]=48;
GuiString(100,20,num,0x00,0x02);
}
}
if(c == 14)
{
GuiBoxFill(50,20,300,36,0x02);
count = 0;
num[0]='\0';
}
if ((c==15)&&(count>0))
{
num[count-1]='\0';
count--;
GuiBoxFill(100,20,200,36,0x02);
GuiString(100,20,num,0x00,0x02);
}
if((c == 16)&&(count == 11))
{
printf("%s",num);
GuiString(100,20,s1,0x00,0x02); //
sendmess(num,M_mess); //发送短消息
GuiString(100,20,s2,0x00,0x02);
count = 0;
}
}
/**********************************************************************
函数名称:
功能描述:
入口参数:
返回值:
日期:
***********************************************************************/
void Com_int(void)
{
unsigned long int speed = F9600; /*波特率参数*/
int parity = NO_PARITY; /*奇偶效验*/
int bits = 8; /*数据位数*/
int stopbits = 1; /*停止位数*/
SerInit(0xff80, speed, parity, bits, stopbits);
}
/**********************************************************************
函数名称:
功能描述:
入口参数:
返回值:
日期:
***********************************************************************/
void main()
{
GuiInit();
GuiBoxFill(0,0,319,233,0x02);
Key_num(75,50,40,40,0x00,0x0c);
/****************************************************/
Com_int();
Gprs_int(); //模块初始化
/****************************************************/
while(!kbhit())
{
c = Get_mouse(75,50,40,40);
if(c != -1)
Get_num();
delay(100);
}
comm_off();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -