简体   繁体   中英

TypeLoadException when calling Mouse.LeftClick()

I am trying to create a bot in C# and I am using Bot Suite library . I am able to move the mouse with desired speed. But I am unable to make mouse click. Here is the small code:

Point target = new Point(32, 875);
Thread.Sleep(3000);
Mouse.Move(target, true, 500);
Thread.Sleep(500);
Mouse.LeftClick();

On Mouse.LeftClick() I am getting this error:

TypeLoadException was unhandled - Could not load type 'BotSuite.NativeMethods' from assembly 'BotSuite, Version=1.0.0.2, Culture=neutral, PublicKeyToken=null' because the method 'SendMessage' has no implementation (no RVA).

How can I fix this?

One of the native DLL imports is missing or incorrect. Re-download the project and re-compile it. I got this to work without any trouble just a day ago.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM