C
C
craimez2014-10-26 22:54:22
C++ / C#
craimez, 2014-10-26 22:54:22

C#. Keyboard hook. After working out the hook, an extra key appears, how to fix it?

There is a keyboard hook. The program runs in the background, the hook catches pressing the hot key.
When the hotkey is caught, the work goes into the function. In this function, I send a ctrl-Insert combination via SendKeys.Send() to get what the user has currently selected on the clipboard. Then the program fulfills its purpose, the program returns to the hook and it returns return (IntPtr)0; (Well, or it was originally CallBackNextHook ... )
So, on some computers everything works fine, as it should, but on others (windows 10, windows 7 - it's lucky, it mostly works) the selected text is overwritten and the last one is inserted instead letter from the hotkey combination. Let's say I pressed ctrl-G, just G was inserted into the text.
The error occurs strictly on certain computers, but I did not find any pattern.
Can anyone advise?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2014-10-28
@vipuhoff

It's hard to say without seeing the code, but most likely the problem lies in the incorrect use of SendKeys.Send()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question