SendInput()键盘字母C / C ++ [英] SendInput() Keyboard letters C/C++

查看:1446
本文介绍了SendInput()键盘字母C / C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 SendInput()来的句子发送到另一个应用程序(记事本),然后将其发送一下<大骨节病>输入键。

I am trying to use SendInput() to send a sentence to another application (Notepad) and then send it hitting the Enter Key.

任何code段?或帮助

Any code snippets? Or help

推荐答案

一个简单得多的C / C ++的例子是<一个href=\"https://batchloaf.word$p$pss.com/2012/04/17/simulating-a-keystroke-in-win32-c-or-c-using-sendinput/\" rel=\"nofollow\">https://batchloaf.word$p$pss.com/2012/04/17/simulating-a-keystroke-in-win32-c-or-c-using-sendinput/

A much simpler C/C++ example is https://batchloaf.wordpress.com/2012/04/17/simulating-a-keystroke-in-win32-c-or-c-using-sendinput/

INPUT input;
WORD vkey = VK_F12; // see link below
input.type = INPUT_KEYBOARD;
input.ki.wScan = MapVirtualKey(vkey, MAPVK_VK_TO_VSC);
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
input.ki.wVk = vkey;
input.ki.dwFlags = 0; // there is no KEYEVENTF_KEYDOWN
SendInput(1, &input, sizeof(INPUT));

input.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &input, sizeof(INPUT));

虚拟键列表codeS
.....

List of virtual key codes .....

这篇关于SendInput()键盘字母C / C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆