Jump to content

VB.Net programmer help needed (C++ geeks welcome too)

Recommended Posts

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 post
Share on other sites

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.

Link to post
Share on other sites

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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...