📄 main.cpp
字号:
#include <windows.h>#include <stdlib.h>#include <stdio.h>void ErrorExit(const char *lpszFunction){ char szBuf[80]; LPVOID lpMsgBuf; DWORD dw = GetLastError(); FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) &lpMsgBuf, 0, NULL ); fprintf(stderr, "%s failed with error %d: %s", lpszFunction, dw, lpMsgBuf); LocalFree(lpMsgBuf); ExitProcess(dw);}int main(int argc, char **argv){ HOOKPROC hkprc; static HINSTANCE hinstDLL; static HHOOK hhook; char buff; hinstDLL = LoadLibraryA("tslib12.dll"); if (hinstDLL == NULL) { ErrorExit("LoadLibrary"); } hkprc = (HOOKPROC)GetProcAddress(hinstDLL, "_CallWndProc@12"); if (hkprc == NULL) { fprintf(stderr, "Failed to get procaddress\n"); return 2; } hhook = SetWindowsHookEx(WH_GETMESSAGE,hkprc,hinstDLL,0); if (hhook == NULL) { fprintf(stderr, "Failed to insert hook\n"); return 3; } printf("Hook installed. Press any key to abort, abort, abort!\n"); fread(&buff, 1, 1, stdin); printf("Uninstalling...\n"); if (! UnhookWindowsHookEx(hhook)) { fprintf(stderr, "Failed to remove hook. This is kinda critical.\n"); return 4; } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -