Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 02:07

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# Simulated Mouseclicks

Discussion on C# Simulated Mouseclicks within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
djb's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 314
Received Thanks: 52
C# Simulated Mouseclicks

Hey guys, I'm working on a pixel based bot and right now I have a class set up for input that looks like this
Code:
class PushKey
    {
        [DllImport("user32.dll", SetLastError = true)]
        static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
        [DllImport("user32.dll")]
        private static extern void mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, IntPtr dwExtraInfo);


 public static void leftClick()
        {
           const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
        const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, new IntPtr());
            mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, new IntPtr());
            MessageBox.Show("mouseclicked");
        }
}
This code works if i want to use it anywhere else, but when i attempt to use it on the game, the hook is blocked im assuming, and although the click is executed (message box pops up) the click doesnt actually work. Does anyone know a way I can get around this to make it look like the input is really coming from my mouse? ive searched for days on this and havent found a better way.

any insight would be greatly appreciated
djb is offline  
Old 10/28/2011, 23:14   #2
 
theoneofgod's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 3,940
Received Thanks: 2,197
I'm guessing the games protection is blocking the input. Not sure how else you could do it, if this is for iSRO and you are running a x64 system, it should work fine.
theoneofgod is offline  
Reply


Similar Threads Similar Threads
Autoit mouseclicks funktionieren nur manchmal
05/20/2011 - AutoIt - 6 Replies
Hey, ich habe ein problem und zwar beschäftige ich mich mit autoit erst seit einen tag und habe schon das erste Problem und zwar MouseClick("Left",194,18) funktioniert nicht immer nur manchmal gibt es ne andere Lösung oder mache ich was flasch ?
Mouseclicks in nicht aktiven Anwedungen
10/17/2009 - AutoIt - 4 Replies
hallo, und zwar verwende ich schon soetwas while 1 $pos = MouseGetPos() sleep(10) mousemove(1171,352,1) _MouseClickPlus( "World of Warcraft", "left", 1171, 352) sleep(10)



All times are GMT +2. The time now is 02:07.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.