We help IT Professionals succeed at work.

Mouse Behavior using Keyboard

angelsrose
angelsrose asked
on
I am having trouble solving this problem coz am new to the language...S.O.S. How can I simulate the mouse events such as moving the mouse pointer using the arrow keys of the keyboard and imitate a mouse left click and right click using any key from the keyboard.
Please experts I really need your HELP....this is using Visual C++.
Comment
Watch Question

You need to capture keyboard message as WM_KEYDOWN, WM_KEYUP ... If you use MFC, you can override the method CWnd::OnKeyDown ....


     http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/keybinpt_9l7y.asp

     http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cwnd.3a3a.onkeydown.asp
   

After that you call the SendInput function synthesizes mouse motions, and button clicks.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/keybinpt_7id0.asp

http://msdn.microsoft.com/library/en-us/winui/keybinpt_3ape.asp
CERTIFIED EXPERT
Author of the Year 2009

Commented:
The so-called 'Accessibility' suite provides a way to perform mouse operations via the keyboard.  It has a programmable interface, but perhaps you just want a way to do this at your own keyboard.

Use Start>>Programs>>Accessories>>Accessibility Accessibility Wizard.  After a bunch of prompts, you get to the MouseKeys section.  Check it out.

-- Dan

Commented:
Dear angelsrose

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "thienpnguyen"

comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Force accepted

** Mindphaser - Community Support Moderator **

Explore More ContentExplore courses, solutions, and other research materials related to this topic.