❓ Send Key/Mouse to crossfire?

Posts 1–15 of 21 · Page 1 of 2
Are you using sendkeys.send?

There are some diffrent ways you can do it

I think crossfire have blocked sendkeys.send like nexon did on combat arms!

If you want to do it the easy way ask WPS(warpathsin)
Quote Originally Posted by Zoom View Post
If you want to do it the easy way ask WPS(warpathsin)
He uses AutoIt, not VB, which is slightly easier to use than VB (IMO), but the GUI is hard to make.

In AutoIt the basic send function is Send("Key to send in string").

There are more complicated ways though, but I'd rather not release that code
Are you actually using API....

Crossfire may be one of those applications that block keystrokes

If it is, Then you are in for a long road and lots of rewriting

Which Includes Bytes , and user32 Keyb Events, Not a "easy task. "
I found something promising in the SendInput API, which apparently will dump the input directly into the input stream.... Any of you guys heard anything about it?
yes they have completely stopped allowing sending keys on there, So here is your answer:

You Cannot do this, try a different game
Quote Originally Posted by guza44_44 View Post
yes they have completely stopped allowing sending keys on there, So here is your answer:

You Cannot do this, try a different game
Yeah you can do it.

It's called User events.
Quote Originally Posted by Lolland View Post
Yeah you can do it.

It's called User events.
well i mean the regular send.keys ways, like a spammer, but ya adding diff code will make things work again
Thanks all for your help, I am currently trying the Sendinput API which should drop it right into the input stream, but it keeps erroring out due to some small inconsistency....
Quote Originally Posted by HackManster View Post
Thanks all for your help, I am currently trying the Sendinput API which should drop it right into the input stream, but it keeps erroring out due to some small inconsistency....
Explain what method you are using, and what the inconsistency's are , and we can probably help
Ok, here is my code.

In the declarations:

Code:
    Const KEYEVENTF_KEYUP = &H2
    Const INPUT_MOUSE = 0
    Const INPUT_KEYBOARD = 1
    Const INPUT_HARDWARE = 2
    Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move 32768
    Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down 2
    Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up 4
    Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' middle button down 32
    Private Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up 64
    Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move 1
    Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down 8
    Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up 16

    Private Structure MOUSEINPUT
        Public dx As Long
        Public dy As Long
        Public mouseData As Long
        Public dwFlags As Long
        Public time As Long
        Public dwExtraInfo As Long
    End Structure

    Private Structure KEYBDINPUT
        Public wVk As Integer
        Public wScan As Integer
        Public dwFlags As Long
        Public time As Long
        Public dwExtraInfo As Long
    End Structure

    Private Structure HARDWAREINPUT
        Public uMsg As Long
        Public wParamL As Integer
        Public wParamH As Integer
    End Structure

    Private Structure GENERALINPUT
        Public dwType As Long
        Public xi() As Byte
    End Structure

    Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, ByVal pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal pDst, ByVal pSrc, ByVal ByteLen) 'I cant type these as Visul Studio doesn't support the Any type

And the sub thats erroring

Code:
   Sub ClickMouse(ByVal x As Long, ByVal y As Long)
        Dim GInput(0 To 1) As GENERALINPUT
        Dim MINPUT As New MOUSEINPUT
        MINPUT.dx = x
        MINPUT.dy = y
        '* 65535 / My.Computer.Screen.WorkingArea.Height * My.Computer.Screen.BitsPerPixel
        MINPUT.mouseData = 0
        MINPUT.dwFlags = MOUSEEVENTF_MOVE + MOUSEEVENTF_LEFTDOWN
        MINPUT.time = 0
        MINPUT.dwExtraInfo = 0
        GInput(0).dwType = INPUT_MOUSE
        CopyMemory(GInput(0).xi(0), MINPUT, Len(MINPUT)) ' errors here *********************************

        MINPUT.dx = x
        MINPUT.dy = y
        '* 65535 / My.Computer.Screen.WorkingArea.Height * My.Computer.Screen.BitsPerPixel
        MINPUT.mouseData = 0
        MINPUT.dwFlags = MOUSEEVENTF_LEFTUP + MOUSEEVENTF_MOVE
        MINPUT.time = 0
        MINPUT.dwExtraInfo = 0
        GInput(1).dwType = INPUT_MOUSE ' keyboard input
        CopyMemory(GInput(1).xi(0), MINPUT, Len(MINPUT))
        Call SendInput(2, GInput(0), Len(GInput(0)))
    End Sub
It says "*********enceexeption: object reference not set to an instance of the object" I can get it to go away by dimentioning ginput(0).xi like so

Code:
Redim Ginput(0).xi(len(MINPUT))
But then it tells me I'm trying to access protected memory.
This Code

Code:
Public Class Form1
    Const KEYEVENTF_KEYUP = &H2
    Const INPUT_MOUSE = 0
    Const INPUT_KEYBOARD = 1
    Const INPUT_HARDWARE = 2
    Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move 32768
    Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down 2
    Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up 4
    Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' middle button down 32
    Private Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up 64
    Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move 1
    Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down 8
    Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up 16

    Private Structure MOUSEINPUT
        Public dx As Long
        Public dy As Long
        Public mouseData As Long
        Public dwFlags As Long
        Public time As Long
        Public dwExtraInfo As Long
    End Structure

    Private Structure KEYBDINPUT
        Public wVk As Integer
        Public wScan As Integer
        Public dwFlags As Long
        Public time As Long
        Public dwExtraInfo As Long
    End Structure

    Private Structure HARDWAREINPUT
        Public uMsg As Long
        Public wParamL As Integer
        Public wParamH As Integer
    End Structure

    Private Structure GENERALINPUT
        Public dwType As Long
        Public xi() As Byte
    End Structure

    Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, ByVal pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal pDst, ByVal pSrc, ByVal ByteLen) 'I cant type these as Visul Studio doesn't support the Any type

    Sub ClickMouse(ByVal x As Long, ByVal y As Long)
        Dim GInput(0 To 1) As GENERALINPUT
        Dim MINPUT As New MOUSEINPUT
        MINPUT.dx = x
        MINPUT.dy = y
        '* 65535 / My.Computer.Screen.WorkingArea.Height * My.Computer.Screen.BitsPerPixel
        MINPUT.mouseData = 0
        MINPUT.dwFlags = MOUSEEVENTF_MOVE + MOUSEEVENTF_LEFTDOWN
        MINPUT.time = 0
        MINPUT.dwExtraInfo = 0
        GInput(0).dwType = INPUT_MOUSE
        CopyMemory(GInput(0).xi(0), MINPUT, Len(MINPUT)) ' errors here *********************************

        MINPUT.dx = x
        MINPUT.dy = y
        '* 65535 / My.Computer.Screen.WorkingArea.Height * My.Computer.Screen.BitsPerPixel
        MINPUT.mouseData = 0
        MINPUT.dwFlags = MOUSEEVENTF_LEFTUP + MOUSEEVENTF_MOVE
        MINPUT.time = 0
        MINPUT.dwExtraInfo = 0
        GInput(1).dwType = INPUT_MOUSE ' keyboard input
        CopyMemory(GInput(1).xi(0), MINPUT, Len(MINPUT))
        Call SendInput(2, GInput(0), Len(GInput(0)))
    End Sub

End Class
Has 0 errors, Running or Debugging....

What else is in your code, the null exception maybe coming from another part of the code,
It can't be; theres no other code. I'll attach a screenshot of the error message. A point of interest; when I view the contents of Ginput(0), it says "Nothing" for xi. Maybe something with visual studio?
Capture.JPGattachment deleted · 20 downloads before removal
OS + SP(If any) + Framwork?

If you have framework 2.0 update to 3.5 (not 4 beta)

I know there was a issue with null reference exceptions that was resolved in 3.5 or with a hotfix in 2.0 , and as far as your users go, make sure network 3.5 is a prerequisite
OK, i solved my earlier two problems... but now I've got another one!

Code changes:

Code:
    Public Structure MOUSEINPUT
        Public dx As Integer
        Public dy As Integer
        Public mouseData As Integer
        Public dwFlags As Integer
        Public dwtime As Integer
        Public dwExtraInfo As Integer
    End Structure

    Public Structure INPUT_TYPE
        Public dwType As Integer
        Public xi As MOUSEINPUT
    End Structure

Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Integer, ByRef pInputs As INPUT_TYPE, ByVal cbSize As Integer) As Integer

Code:
    Sub ClickMouse(ByVal x As Long, ByVal y As Long)
        Dim inputEvents As INPUT_TYPE

        inputEvents.xi.dx = x
        inputEvents.xi.dy = y
        inputEvents.xi.mouseData = 0
        inputEvents.xi.dwFlags = MOUSEEVENTF_MOVE
        inputEvents.xi.dwtime = 0
        inputEvents.xi.dwExtraInfo = 0
        inputEvents.dwType = INPUT_MOUSE
        Dim s = System.Runtime.InteropServices.Marshal.SizeOf(GetType(INPUT_TYPE))

        If SendInput(1, inputEvents, s) = 0 Then MsgBox(System.Runtime.InteropServices.Marshal.GetLastWin32Error.ToString)
    End Sub
The function call works fine, but the mouse just sits there. I figured out the API was returning 0 (the error code) and that I had to get the last win32error code. This told me it was code 87, or

87 The parameter is incorrect. ERROR_INVALID_PARAMETER
So now I'm back to square one!!
Posts 1–15 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us