Search code examples
c#flashmousevirtualhandle

C# virtual mouse click in Flash apps


I have a problem with C# virtual mouse click.. you know that we should use "user32.dll" library and the mouse_event functions.. I use the following function :

        [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 = 0x0002;
    private const int MOUSEEVENTF_LEFTUP = 0x0004;
    private const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
    private const int MOUSEEVENTF_MIDDLEUP = 0x0040;
    private const int MOUSEEVENTF_MOVE = 0x0001;
    private const int MOUSEEVENTF_XDOWN = 0x0080;
    private const int MOUSEEVENTF_XUP = 0x0100;
    private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
    private const int MOUSEEVENTF_RIGHTUP = 0x0010;

and use this like that :

mouse_event(MOUSEEVENTF_LEFTDOWN, X, Y, 0, 0);

Guys, It is work on the all applications very good and Ok ! But in Flash Applications no

I have seen a post in here :

Problem automating mouse and interacting with Flash apps

They said that use from the all mouse_event functions , I used all of them but no one couldn't help me...

An other person who says use SendInput , You know better than me that the shapes that made by flash player doesn't have handle. and just main program has access to them. so we can't use SendInput...

I wanna do my problem with this code.. ( I don't like use difficult methods like Dynamic Data Exchange , etc... ) I wanna do it with my learnings... Can i ?

Thank you very much...


Solution

  • I found it...

    You should Run your process as Administrator to do that...