如何在不使用键盘的情况下获得自动按键 [英] How do I get automatic keypress without using keyboard

查看:103
本文介绍了如何在不使用键盘的情况下获得自动按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为这个项目进行实习,这需要我激励按键。也就是说,当我点击时,我需要它来输入从文本文件中读取的数据而不使用键盘。

这可以使用sendkeys()或keybd_event吗?

我一直在努力寻找解决方案。



我尝试了什么:



这是一个庞大项目的一小部分,基本上我有一个用户界面,当我点击文本框时,我希望它自动输入为文本读取文件。我根本不应该使用键盘。

Im working on this project for an internship and it requires me to stimulate keypress. That is, when I click, I need it to type data that was read from a text file without me using the keyboard.
Is this possible using sendkeys() or keybd_event?
I've been trying long to find a solution.

What I have tried:

This is a small part of a huge project, basically I have a UI, and when I click on the text box, I want it to automatically type in as read from a text file. I should not have to use the keyboard at all.

推荐答案

类似发送输入功能 [ ^ ]?如果您使用的是Windows。
Something like SendInput function[^]? that is if you are using Windows.


是否自动输入文本框?最终结果将是整个文件 - 或者你阅读的内容多少 - 所以为什么不更新文本框值(例如,如果在C ++ .net中)。



如果你使用实际打字的按键模拟,你会做什么来减慢速度,以便它不会立即出现,就好像它只是一次放在那里一样?



分析文本框内容可以通过onchange事件(例如)进行。



如果不是在.NET中,你可以使用fgetc()在循环中读/写,将它们提供给显示器。



最终,你期望看到什么或者do(因为你提到它作为UI的一部分)要求模拟来自文件数据的按键输入?这会影响如何回答问题
Have it automatically type in to the textbox? The final result will be the entire file - or however much you read - so why not just update the text-boxes value (for e.g, if in C++.net).

If you use a keypress simulation of actual typing, what will you do to slow it down so it all doesn't appear in an instant, just as though it were simply placed there all at once?

Analysis of the text box content can be done via onchange event (for example).

If not in .NET, you can use fgetc() to read/write in a loop, feeding them to the display.

Ultimately, what do you expect to see or do (since you mentioned it as part of a UI) that mandates simulating keypress input from file data? That would effect how to answer the question


这篇关于如何在不使用键盘的情况下获得自动按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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