1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[C# Discussion] Virtual mouse movement and click. Without moving the real cursor

Discussion in 'C, C++, C#' started by ldg2002, Apr 20, 2013.

  1. ldg2002

    ldg2002 Registered Member

    Joined:
    Jun 5, 2012
    Messages:
    66
    Likes Received:
    6
    Home Page:
    Hi guys, I would like to be able to simulate a movement and a click of the mouse, without using the real mouse. i would use a virtual mouse, because even if my application's launch 10 processes at the same time, must be able to perform each movement and clicks in different windows.i mean a ghost mouse, 'cause every process that i launch must have a personal mouse
    thanks
     
  2. Herion

    Herion Jr. VIP Jr. VIP Premium Member

    Joined:
    Jul 8, 2012
    Messages:
    289
    Likes Received:
    73
    What are you trying to do? There are most likely more suitable alternatives. Not really into this sort of thing, but maybe SendInput will work well for you? Not sure whether or not it uses the actual mouse or not though, so you'd have to look into that yourself.
     
  3. capripio

    capripio Regular Member

    Joined:
    Dec 25, 2010
    Messages:
    248
    Likes Received:
    157
    Occupation:
    Programmer
    Location:
    127.0.0.1
    Well you can records current mouse work and play it! & I don't seen something like this!
     
  4. SuperTee

    SuperTee Regular Member Premium Member

    Joined:
    Nov 25, 2011
    Messages:
    216
    Likes Received:
    118
    Location:
    Switzerland
    Home Page:
    What do you want to click?
     
  5. theMagicNumber

    theMagicNumber Regular Member

    Joined:
    May 13, 2010
    Messages:
    345
    Likes Received:
    195
  6. Chris22

    Chris22 Regular Member

    Joined:
    Sep 29, 2010
    Messages:
    400
    Likes Received:
    1,059
    Are you trying to click on buttons in a web browser or buttons on a desktop application?
     
  7. ldg2002

    ldg2002 Registered Member

    Joined:
    Jun 5, 2012
    Messages:
    66
    Likes Received:
    6
    Home Page:
    Hi! i'm trying to click on awesomium webcontrol. i've 10/20 process istances and i need a ghost(virtual,ecc...) mouse for every window. thank you so much for the help!
     
  8. MysteryGuest

    MysteryGuest Registered Member

    Joined:
    Mar 7, 2013
    Messages:
    63
    Likes Received:
    18
    Occupation:
    Freelancer
    Location:
    Virtual World!
    try something like this;)

    Code:
    using System;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    
    public class Form1 : Form
    {
      [DllImport("user32.dll", CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
      public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
    
      private const int MOUSEEVENTF_LEFTDOWN = 0x02;
      private const int MOUSEEVENTF_LEFTUP = 0x04;
      private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
      private const int MOUSEEVENTF_RIGHTUP = 0x10;
    
    public void DoMouseClick()
      {
         //Call the imported function with the cursor's current position
         int X = Cursor.Position.X;
         int Y = Cursor.Position.Y;
         mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0);
      }
    }

    however this is NOT a virtual mouse, i can deep further to build such application. If you want me too i can send you the source once it's done.
     
  9. The Real Red

    The Real Red Newbie

    Joined:
    Apr 3, 2013
    Messages:
    26
    Likes Received:
    2
    thank you guest, i have been looking into this for a bit. i appreciate it alot. i would pm you but i cant
     
  10. MysteryGuest

    MysteryGuest Registered Member

    Joined:
    Mar 7, 2013
    Messages:
    63
    Likes Received:
    18
    Occupation:
    Freelancer
    Location:
    Virtual World!
    just add me on skype instead, im wiling to hep you out! MysteryGuest18 is my skype name.