Click here to Skip to main content
14,332,142 members
Rate this:
Please Sign up or sign in to vote.
Knowledge of the topic: C / C++, Windows API, C#, and something along these.

I have an application written on C#. We will call it A. Application A uses the Windows API to simulate keyboard key press (TAB, some text, SHIFT) using SendInput (link). I can note that when using this simulation method in applications such as Notepad, Chrome works without any problems.

The B application, which needs to be filled in by simulating keys, is written in C/C++, but I do not know which version and details. If there is a familiar one, it's about Micros Fidelio.

The problem is that when simulating the TAB keys from application A, application B stops, jams, undetect TAB key press. Even by physically pressing the TAB keyboard the cursor does not move from its current position. Only after a few key press passes. Another thing that happens is keyboard shortcuts like Alt + N also do not work sometimes and sometimes work. Is there any buffer with the simulated keys and when you fill that buffer you can not perform the next push?



My question is, does anyone have a way to solve the problem of omitting TABs?

What I have tried:

I've tried out delay between TABs of the 100, 250, 500 ms variety, but they still detect.

What I have noticed:
* when restarting Application B the simulation is working, but after a certain period of time it accumulates again and starts to detect
* when the keyboard language is switched to Cyrillic, the keyboard shortcuts do not work and the writing of Cyrillic text goes out - ?????

I have test also AutoHotKey and there is a problem there also.
Posted
Comments
Richard MacCutchan 12-May-19 4:05am
   
Check the source code of application B to see why it does not respond.
Zhivko Kabaivanov 12-May-19 4:23am
   
i don't have the source code of the app B
BillWoodruff 12-May-19 5:12am
   
Can you take the "other app" and successfully send key events to it ?
Zhivko Kabaivanov 12-May-19 5:34am
   
what do you mean?
Gerry Schmitz 12-May-19 17:18pm
   
What fun! Fer Pete's sake, say what App B is supposed to do. Maybe something hilarious like Notepad to create a text file?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Maybe these articles will be of help: https://dzone.com/articles/sending-keys-other-apps[^]
and: Sending Keystrokes to another Application in C#[^]

Another option might be using an automation tool like AutoHotkey, see overview here: https://www.slant.co/topics/2195/~gui-automation-tools-for-windows[^]
   
v2
Comments
Zhivko Kabaivanov 12-May-19 4:23am
   
is there an another alternative to sending keystrokes?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100