Click here to Skip to main content
15,906,766 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi....

Want To Control Working of Mouse using C#

Please Help
Posted
Comments
Mehdi Gholam 5-Oct-11 1:44am    
What do you mean?
Sergey Alexandrovich Kryukov 5-Oct-11 1:58am    
I think I have an idea, provided some answer, please see.
--SA
hitech_s 5-Oct-11 1:50am    
in which way you want to control plz be specific
elaborate your question then only you will get solution quickly

1 solution

If I could correctly parse you grammar, you may mean controlling mouse cursor. In System.Windows.Forms, this is done via the class System.Windows.Forms.Cursor.

Use the static property System.Windows.Forms.Cursor.Positin to read and modify the position of mouse cursor on screen.

See:
http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.aspx[^],
[^].

Simulation of mouse clicks and any other input is more difficult. You will need to P/Invoke Windows API SendInput, see http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[^]. It simulates input on low-level, with no regard to windows, but using P/Invoke breaks platform compatibility of the code; such code could be used only on Windows.

—SA
 
Share this answer
 
Comments
Varinder Raii 5-Oct-11 2:07am    
Actually I wants to Start and Stop its Working

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