Is it possible for a program to send keystrokes or messages to Windows 7 (the operating system it's running on) to simulate the effect of a user physically pressing the Windows key on their keyboard, for example; in C++, using the Windows API?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
You can do any simulated input using SendInput, however, you are bound by the application integrity level (that is, you cannot inject input into applications that have a higher level than yours).
The SendInput function has been available for ages, and should do just what you need.
Beginners often try to send keys to windows because they think it is the easiest solution. It is sure easy to reply by saying it is possible. Often, after the developer invests a significant amount of time, it becomes complicated. One reason it is complicated is because you must ensure that the control (the textbox or whatever) has the focus. Then you have to do something to get the data processed, such as push a button. You might need to read the window to decide what to do next.
An alternative is to go up a level and try to control anapplication by accessing the controls and their parent (the window). So in other words you can put data into a textbox directly as a string, not by typing keys into it. You can send a BN_CLICKED notification message to the wndow instead of sending an enter key to the button to click the button. You should look for ways to do that type of thing. It is totally possible.
Become familiar with Spy++; it is a tool that can really help you to explore the controls and windows and such.