Joker9125 Posted February 7, 2006 Share Posted February 7, 2006 I've been trying to develop a game bot type program simillar to AutoIt in VB.Net but I plan on eventually incorporating some features that AutoIt Simply does not, which is why I'm trying to make my own and not just use AutoIt and hey its a good learning expirence. I have been able to get my program to make the mouse move and to emulate keyboard strokes in programs like notepad using simple API calls like Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Const VK_A = &H41 keybd_event VK_A, 0, 0, 0 The application can send mouse events and such to games with no problems, however I have yet to be able to figure out how to get a keystroke to work, games simply will not recognize it. Currently I've been trying to get this to work on my own for a month and seem to have hit a brick wall and yes I have literally been through about 100 google sites so far, but 95% of the code examples I have seen were written in VB6 and do NOT work in VB.Net and the remaining 5% claim to be written in .Net but simply just dont work. Im asking here because your already doing the part of my application that I'm failing at. I have taken some mid level college C++ courses and have already looked over the source code listed in the sticky but can't seem to find which part deals with mouse and keyboard emulation so I ask that if your response is "Look at the code and figure it out yourself" to please at least give me the exact file and function name I should be looking at. So now after all that explination heres my basic questions. 1. How are you doing the mouse/keyboard emulation 2. Is this just not possible in VB.Net? 3. Should I just scrap everything and try it in C++? Link to comment Share on other sites More sharing options...
Oxin8 Posted February 7, 2006 Share Posted February 7, 2006 1. I'm not a dev... 2. Yes, it's possible. 3. You're choice I don't know much as I've only ever used 6.0 and never .NET but this should work. A quick search of the source code looks like "sendkeys.cpp" is probably where you need to look. If you mean what I think you mean by keystroke, you might have to send a key down, and then send that same key up. Maybe look into the SendMessage Api. Just trying to throw some ideas out there for ya. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Joker9125 Posted February 7, 2006 Author Share Posted February 7, 2006 (edited) *EDIT* Downloaded the wrong source code by mistake................... :"> *EDIT* Edited February 26, 2006 by Joker9125 Link to comment Share on other sites More sharing options...
w0uter Posted February 7, 2006 Share Posted February 7, 2006 if you want it that bad you should actually try you know ... the function is spread over a few peices trace it from the send command My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 8, 2006 Share Posted February 8, 2006 You can do emulation calls from VB, but C++ makes it much quicker with the super windows header of superiority, <windows.h>. If you are using .NET, there is actually a way to move the mouse, although it wasn't meant for such use. See (System.Windows.Forms.Cursor.Position As System.Drawing.Point). It is a read/write Property, so you can set it to a new System.Drawing.Point structure to move the mouse (new System.Drawing.Point(x, y) or if you are more courageous, Imports System.Drawing...new Point(x, y)). Link to comment Share on other sites More sharing options...
Joker9125 Posted February 8, 2006 Author Share Posted February 8, 2006 (edited) Turns out I was missing something very very obvious. Edited February 26, 2006 by Joker9125 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now