Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > Peripherals
Register FAQ Calendar Mark Forums Read

Peripherals Buying advice and discussions about peripherals like scanners, printers, mice, keyboards, gamepads etc.


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 08-12-2005, 08:41 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Dec 2005
Posts: 3
Default [csharp] Simulating mouse movement and events


anyone has code that can help me do the following in c# ?

a) move the mouse on the screen, without physically moving the mouse (movement simulation)
b) simulate a left, right or double click at the cursor's current position programatically..

have found the following code on msdn regarding the above.. have got the a) to work.. but no luck with b)

a)
Code:
private void MoveCursor(int a, int b)
        {
            this.Cursor = new Cursor(Cursor.Current.Handle);
            Cursor.Position = new Point(Cursor.Position.X + a, Cursor.Position.Y + b);
            //Cursor.Clip = new Rectangle(this.Location, this.Size);
        }
b)
Code:
To programmatically click the right mouse button

   1. Create a MouseEventArgs whose Button property is set to the System.Windows.Forms.MouseButtons.Right value.
   2. Call the OnMouseClick method with this MouseEventArgs as the argument.

There are other ways to simulate mouse input. For example, you can programmatically set a control property that represents a state that is typically set through mouse input (such as the Checked property of the CheckBox control), or you can directly call the delegate that is attached to the event you want to simulate.
help would me much appreciated

EDIT : am running Microsoft Visual C# 2005 Express Edition, on a pentium4 x86.. windows XP.
pyr0 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 08-12-2005, 10:06 PM   #2 (permalink)
Right Off the Assembly Line
 
Join Date: Dec 2005
Posts: 3
Default

bump.. need help :'(
pyr0 is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by topgear
- by Charan

Advertisement




All times are GMT +5.5. The time now is 05:50 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2