sbl_xh制作
实时更改
实时置顶
可编辑
c++14运行环境
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
#define NORMAL 7
#define HIGHLIGHT 0xA0
inline void gotoTop() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos = {0, 0};
SetConsoleCursorPosition(hConsole, pos);
}
inline void hideCursor() {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursorInfo;
GetConsoleCursorInfo(hConsole, &cursorInfo);
cursorInfo.bVisible = FALSE;
SetConsoleCursorInfo(hConsole, &cursorInfo);
}
inline bool isKeyPressed(int vk_code) {
return (GetAsyncKeyState(vk_code) & 0x8000) != 0;
}
void printKey(const char* text, int vk_key = -1) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
if (vk_key != -1 && isKeyPressed(vk_key)) {
SetConsoleTextAttribute(hConsole, HIGHLIGHT);
} else {
SetConsoleTextAttribute(hConsole, NORMAL);
}
printf("%s", text);
SetConsoleTextAttribute(hConsole, NORMAL);
}
int main() {
hideCursor();
SetConsoleTitleA("键盘字符映射表 windows key from sbl_xh 1341489");
while (1) {
HWND hWnd = GetConsoleWindow();
SetWindowPos(
hWnd,
HWND_TOPMOST,
1167, 935,//窗口初始位置
780, 167,
SWP_SHOWWINDOW
);
gotoTop();
cout << "windows key from sbl_xh 1341489\n";
printKey("esc", VK_ESCAPE); printf("|");
printf(" |");
printKey("f 1", VK_F1); printf("|");
printKey("f 2", VK_F2); printf("|");
printKey("f 3", VK_F3); printf("|");
printKey("f 4", VK_F4); printf("|");
printf(" |");
printKey("f 5", VK_F5); printf("|");
printKey("f 6", VK_F6); printf("|");
printKey("f 7", VK_F7); printf("|");
printKey("f 8", VK_F8); printf("|");
printf(" |");
printKey("f 9", VK_F9); printf("|");
printKey("f10", VK_F10); printf("|");
printKey("f11", VK_F11); printf("|");
printKey("f12", VK_F12); printf("| |");
printKey("prt", VK_SNAPSHOT); printf("|");
printKey("slk", VK_SCROLL); printf("|");
printKey("pau", VK_PAUSE); printf("| |");
printKey("nlk", VK_NUMLOCK); printf("|");
printKey("+ plus", VK_ADD); printf("|\n");
printKey("` ~", VK_OEM_3); printf("|");
printKey("1 !", '1'); printf("|");
printKey("2 @", '2'); printf("|");
printKey("3 #", '3'); printf("|");
printKey("4 $", '4'); printf("|");
printKey("5 %", '5'); printf("|");
printKey("6 ^", '6'); printf("|");
printKey("7 &", '7'); printf("|");
printKey("8 *", '8'); printf("|");
printKey("9 (", '9'); printf("|");
printKey("0 )", '0'); printf("|");
printKey("- _", VK_OEM_MINUS); printf("|");
printKey("= +", VK_OEM_PLUS); printf("|");
printKey("<-backsapen", VK_BACK); printf("| |");
printKey("ins", VK_INSERT); printf("|");
printKey("hme", VK_HOME); printf("|");
printKey("pgu", VK_PRIOR); printf("| |");
printKey("7sn", VK_NUMPAD7); printf("|");
printKey("8et", VK_NUMPAD8); printf("|");
printKey("9nt", VK_NUMPAD9); printf("|\n");
printKey("tab", VK_TAB); printf("|");
printKey("q Q", 'Q'); printf("|");
printKey("w W", 'W'); printf("|");
printKey("e E", 'E'); printf("|");
printKey("r R", 'R'); printf("|");
printKey("t T", 'T'); printf("|");
printKey("y Y", 'Y'); printf("|");
printKey("u U", 'U'); printf("|");
printKey("i I", 'I'); printf("|");
printKey("o O", 'O'); printf("|");
printKey("p P", 'P'); printf("|");
printKey("[ {", VK_OEM_4); printf("|");
printKey("] }", VK_OEM_6); printf("|");
printKey("tab'|' or \\", VK_OEM_5); printf("| |");
printKey("del", VK_DELETE); printf("|");
printKey("end", VK_END); printf("|");
printKey("pgd", VK_NEXT); printf("| |");
printKey("4fr", VK_NUMPAD4); printf("|");
printKey("5fv", VK_NUMPAD5); printf("|");
printKey("6sx", VK_NUMPAD6); printf("|\n");
printKey("Clk", VK_CAPITAL); printf("|");
printKey("a A", 'A'); printf("|");
printKey("s S", 'S'); printf("|");
printKey("d D", 'D'); printf("|");
printKey("f F", 'F'); printf("|");
printKey("g G", 'G'); printf("|");
printKey("h H", 'H'); printf("|");
printKey("j J", 'J'); printf("|");
printKey("k K", 'K'); printf("|");
printKey("l L", 'L'); printf("|");
printKey("; :", VK_OEM_1); printf("|");
printKey("' \"", VK_OEM_7); printf("|");
printKey("enter or return", VK_RETURN); printf("| | | | | |");
printKey("1oe", VK_NUMPAD1); printf("|");
printKey("2tw", VK_NUMPAD2); printf("|");
printKey("3te", VK_NUMPAD3); printf("|\n");
printKey("sft", VK_LSHIFT); printf("|");
printKey("z Z", 'Z'); printf("|");
printKey("x X", 'X'); printf("|");
printKey("c C", 'C'); printf("|");
printKey("v V", 'V'); printf("|");
printKey("b B", 'B'); printf("|");
printKey("n N", 'N'); printf("|");
printKey("m M", 'M'); printf("|");
printKey(", <", VK_OEM_COMMA); printf("|");
printKey(". >", VK_OEM_PERIOD); printf("|");
printKey("/ ?", VK_OEM_2); printf("|");
printKey("right_shift or rsft", VK_RSHIFT); printf("| | |");
printKey("u p", VK_UP); printf("| | |");
printKey("0ze", VK_NUMPAD0); printf("|");
printKey("-", VK_SUBTRACT); printf("|");
printKey("*", VK_MULTIPLY); printf("|");
printKey("/", VK_DIVIDE); printf("|||\n");
printKey("ctr", VK_LCONTROL); printf("|");
printKey("win", VK_LWIN); printf("|");
printKey("alt", VK_LMENU); printf("|");
printKey(" sapen or right ", VK_SPACE); printf("|");
printKey("alt", VK_RMENU); printf("|");
printKey("fn"); printf("|");
printKey("win", VK_RWIN); printf("|");
printKey("ctr", VK_RCONTROL); printf("| |");
printKey("lft", VK_LEFT); printf("|");
printKey("dwn", VK_DOWN); printf("|");
printKey("rgt", VK_RIGHT); printf("| |");
printKey("L", VK_LBUTTON); printf("|");
printKey("M", VK_MBUTTON); printf("|");
printKey("R", VK_RBUTTON); printf("|");
printKey("F", VK_XBUTTON1); printf("|");
printKey("B", VK_XBUTTON2); printf("|||\n");
Sleep(10);
}
return 0;
}