简单写了一下
很简单的demo
闲着没事干
#include "stdafx.h" #include <thread> #include <Windows.h> void Send() { HWND WIN = FindWindowA(NULL,"TIM的聊天对象的名字"); keybd_event(VK_LBUTTON, 0, 0, 0);//激活TIM PostMessageA(WIN, WM_KEYUP, 65, 0);//发送字符 //下面是发送回车 PostMessageA(WIN, WM_KEYDOWN, 13, 0); PostMessageA(WIN, WM_KEYUP, 13, 0); keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); } int main() { using namespace::std; while (true) { Sleep(50);//50毫秒输出一次 thread t(Send); t.join(); } system("pause"); return 0; }
原文地址:https://www.cnblogs.com/T-ARF/p/9436455.html
时间: 2024-10-03 20:10:53