Click here to Skip to main content
15,069,020 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi I want to create a character key
And control this key how to press in a specific place on the screen
like a mouse We control the location of the click by cursor position
What are the countries that control the setting of the keystroke?
In a specific place on the desktop screen
I Want Know What function is used in place of the character position
like this cursor position
How do I use keybd event With pressure mode selected
This project is very important in my studies, please help me

What I have tried:

C#
Cursor.Position = New Point(940, 333)

           keybd_event(CByte(Keys.C)

I tried to use this code, but the mouse pointer is moving and the button is not pressed within this specific space, the letter c
Posted
Updated 3-Sep-21 19:50pm
v2

1 solution

Moving the mouse doesn't alter what is called the "focus" - which is the control that will receive keyboard input.

Try it manually: create a form with three text boxes, and wave the mouse about. No matter where the mouse is, what you type will always go to the same textbox unless you actually click the mouse button to move the Caret - the vertical line - into a different one. The normal way to set where input goes is to use the Focus method for that control rather than try to wave the mouse about and hope!

If you have multiple applications then it's even worse, because the keyboard input always goes to the application which has the focus, not the app the mouse is over, and even simulating the mouse click will change the app focus, but not the control focus.
   
Comments
Mohenad Essam 6-Sep-21 19:23pm
   
How can I determine the key press in a specific place on the screen
keybd_event Location = New Point(950, 330)
OriginalGriff 7-Sep-21 2:09am
   
You can't.
Keypresses aren't related to a "screen position" they are related to a "input window": a text box, a button, a scroll bar - something that "knows what to do with typed stuff".

The screen doesn't - it is just a display device - and the mouse location is completely unrelated to the keyboard. Try it: start typing in a text box and move the mouse about all you like. Does the keyboard input become even slightly upset or difficult? No - because the two are completely independant!

It is possible to intercept keyboard input with "non input controls" such as forms, and many apps to that to provide "function keys" - but that information doesn't have any mouse data associated with it, and because Windows isn't a real time operating system the mouse position when the keystroke is processed can be wildly different from the position it was at when the key was pressed.

What are you trying to do that you think this is the solution?
Mohenad Essam 10-Sep-21 2:24am
   
I want to create a like keyMapNodes c++ in vb.net
Mohenad Essam 10-Sep-21 2:24am
   
I want to create a like keyMapNodes c++ in vb.net

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900