⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyborad.cpp

📁 vt100终端仿真程序
💻 CPP
字号:
#include "stdafx.h"
#include "keyborad.h"

extern int g_iArrPara[50]; //函数参数组 iParam[0] 存放参数个数,iParam[1],iParam[2]...为相应参数 

struct struKey struKeyMsp;
  
//键盘控制****************************************

//键盘初始化
int InitKeyborad()
{
	int iKeyLock=0;			//键盘是否锁定,0:未锁,1:加锁
    int iKeyContState=1;		//键连发达国家,0: 有效,1:无效
    int iKeySound=1;			//击键声,0:有声,1:无声
    int iKeyCursor=0;			//光标键,0:正常光标键,1:应用光标键            
    int iKeyAssBoard=1;		//应用副盘,0:应用,1:数字
    int iKeyNewRow=0;			//是否新行,0:新行,1:非新行驶
    int iKeyBS=0;				//BackSpace键设置,0:退格键,1:删除键
    int iKeyCtrl=1;			//本端功能键,0--应用,1--本端

	return 0;
}

//锁定键盘
//CSI 2 h	
//锁存键盘数据(不超过15个)暂停向主机发送,直到开放为止。
int KeyLocked()
{
	//?jim
	struKeyMsp.iKeyLock=1;

	return 0;
}

//开放键盘
//CSI 2 l	
//允许键盘向主机发送数据。
int KeyUnlocked()
{
	//?jim
	struKeyMsp.iKeyLock=0;
	return 0;
}

//键连发
//CSI ? 8 h	键盘连发有效
int KeyContEnable()
{
	//?jim
	struKeyMsp.iKeyContState=0;
	return 0;
}

//CSI ? 8 l	键盘连发无效
int KeyContUnEnable()
{
	//?jim
	struKeyMsp.iKeyContState=1;
	return 0;
}

//击键声
//CSI / 5 h	击键声有效
int KeySound()
{
	struKeyMsp.iKeySound=0;
	return 0;
}

//CSI / 5 l	击键声无效
int KeyNoSound()
{
	struKeyMsp.iKeySound=1;
	return 0;
}

//光标键
//应用光标键	
//CSI ? 1 h	
//光标键产生"应用"控制序列。见键盘代码一节。
int KeyAppCursor()
{
	//?jim
	struKeyMsp.iKeyCursor=1;
	return 0;
}

//正常光标键
//CSI ? 1 l
//光标键产生ANSI标准的控制序列。见键盘代码一节。
int KeyNormalCursor()
{
	//Jim
	struKeyMsp.iKeyCursor=0;
	return 0;
}

//副盘
//应用副盘	
//ESC =	
//副键盘产生"应用"控制序列。见键盘代码一节。
int KeyAppBoard()
{
	//?jim

	struKeyMsp.iKeyAssBoard=0;
	return 0;
}

//数字副盘	
//ESC >	
//副键盘产生数字等字符序列,PF键不变。见键盘代码一节。
int KeyNumBoard()
{
	//?jim
	struKeyMsp.iKeyAssBoard=1;
	return 0;
}

//是否新行
//新行	
//CSI 20 h	
//接收LF、FF或VT控制码后,光标移至下一行行首;Return键发送CR和LF控制码。
int KeyNewRow()
{
	//?
	struKeyMsp.iKeyNewRow=0;
	return 0;
}

//非新行	
//CSI 20 l	
//接收LF、FF或VT控制码后,光标移至下一行当前列;Return键发送CR控制码。
int KeyNoNewRow()
{
	//?
	struKeyMsp.iKeyNewRow=1;
	return 0;
}


//BackSpace键	
//CSI ? 67 h	作为退格键发送BS。
int KeyBSBS()
{
	//?
	struKeyMsp.iKeyBS=0;
	return 0;
}

//CSI ? 67 l	作为删除键发送DEL。
int KeyBSDEL()
{
	//?
	struKeyMsp.iKeyBS=1;
	return 0;
}

//本端功能键
/*                0--顶排功能键作为应用程序功能使用
                     CTRL功能键作为本端功能键使用
                  1--顶排功能键作为本端功能键使用
                     CTRL功能键作为应用程序功能使用
*/
//CSI / 2 h	顶排功能键作为应用程序功能使用
//CTRL功能键作为本端功能键使用
int KeyCtrlLocal()
{
	struKeyMsp.iKeyCtrl=0;
	return 0;
}

//CSI / 2 l	顶排功能键作为本端功能键使用
//CTRL功能键作为应用程序功能使用
int KeyCtrlApp()
{
	struKeyMsp.iKeyCtrl=1;
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -