Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInteger, ByVal dwExtraInfo As UInteger)
Const KEYEVENTF_KEYUP = &H2
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetForegroundWindow() As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr, _
ByRef lpdwProcessId As Integer) As Integer
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub press(ByVal mykey As Keys)
keybd_event(CByte(mykey), 0, 0, 0)
keybd_event(CByte(mykey), 0, KEYEVENTF_KEYUP, 0)
End Sub
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Dim fgWin = GetForegroundWindow()
Dim fgPid As New Integer()
GetWindowThreadProcessId(fgWin, fgPid)
Dim proc = System.Diagnostics.Process.GetProcessById(fgPid)
If (proc.ProcessName = "bout.dat") Then
press(Keys.F8)
End If
End Sub
also i have tried this code and did not work too
Code:
Imports System.Runtime.InteropServices
Public NotInheritable Class InputHelper
Private Sub New()
End Sub
#Region "Methods"
#Region "PressKey()"
''' <summary>
''' Virtually presses a key.
''' </summary>
''' <param name="Key">The key to press.</param>
''' <param name="HardwareKey">Whether or not to press the key using its hardware scan code.</param>
''' <remarks></remarks>
Public Shared Sub PressKey(ByVal Key As Keys, Optional ByVal HardwareKey As Boolean = False)
If HardwareKey = False Then
InputHelper.SetKeyState(Key, False)
InputHelper.SetKeyState(Key, True)
Else
InputHelper.SetHardwareKeyState(Key, False)
InputHelper.SetHardwareKeyState(Key, True)
End If
End Sub
#End Region
#Region "SetKeyState()"
''' <summary>
''' Virtually sends a key event.
''' </summary>
''' <param name="Key">The key of the event to send.</param>
''' <param name="KeyUp">Whether to push down or release the key.</param>
''' <remarks></remarks>
Public Shared Sub SetKeyState(ByVal Key As Keys, ByVal KeyUp As Boolean)
Key = ReplaceBadKeys(Key)
Dim KeyboardInput As New KEYBDINPUT With {
.wVk = Key,
.wScan = 0,
.time = 0,
.dwFlags = If(KeyUp, KEYEVENTF.KEYUP, 0),
.dwExtraInfo = IntPtr.Zero
}
Dim Union As New INPUTUNION With {.ki = KeyboardInput}
Dim Input As New INPUT With {
.type = INPUTTYPE.KEYBOARD,
.U = Union
}
SendInput(1, New INPUT() {Input}, Marshal.SizeOf(GetType(INPUT)))
End Sub
#End Region
#Region "SetHardwareKeyState()"
''' <summary>
''' Virtually sends a key event using the key's scan code.
''' </summary>
''' <param name="Key">The key of the event to send.</param>
''' <param name="KeyUp">Whether to push down or release the key.</param>
''' <remarks></remarks>
Public Shared Sub SetHardwareKeyState(ByVal Key As Keys, ByVal KeyUp As Boolean)
Key = ReplaceBadKeys(Key)
Dim KeyboardInput As New KEYBDINPUT With {
.wVk = 0,
.wScan = MapVirtualKeyEx(CUInt(Key), 0, GetKeyboardLayout(0)),
.time = 0,
.dwFlags = KEYEVENTF.SCANCODE Or If(KeyUp, KEYEVENTF.KEYUP, 0),
.dwExtraInfo = IntPtr.Zero
}
Dim Union As New INPUTUNION With {.ki = KeyboardInput}
Dim Input As New INPUT With {
.type = INPUTTYPE.KEYBOARD,
.U = Union
}
SendInput(1, New INPUT() {Input}, Marshal.SizeOf(GetType(INPUT)))
End Sub
#End Region
#Region "ReplaceBadKeys()"
''' <summary>
''' Replaces bad keys with their corresponding VK_* value.
''' </summary>
''' <remarks></remarks>
Private Shared Function ReplaceBadKeys(ByVal Key As Keys) As Keys
Dim ReturnValue As Keys = Key
If ReturnValue.HasFlag(Keys.Control) Then
ReturnValue = (ReturnValue And Not Keys.Control) Or Keys.ControlKey 'Replace Keys.Control with Keys.ControlKey.
End If
If ReturnValue.HasFlag(Keys.Shift) Then
ReturnValue = (ReturnValue And Not Keys.Shift) Or Keys.ShiftKey 'Replace Keys.Shift with Keys.ShiftKey.
End If
If ReturnValue.HasFlag(Keys.Alt) Then
ReturnValue = (ReturnValue And Not Keys.Alt) Or Keys.Menu 'Replace Keys.Alt with Keys.Menu.
End If
Return ReturnValue
End Function
#End Region
#End Region
#Region "WinAPI P/Invokes"
<DllImport("user32.dll", SetLastError:=True)>
Private Shared Function SendInput(ByVal nInputs As UInteger, <MarshalAs(UnmanagedType.LPArray)> ByVal pInputs() As INPUT, ByVal cbSize As Integer) As UInteger
End Function
<DllImport("user32.dll")> _
Private Shared Function MapVirtualKeyEx(uCode As UInteger, uMapType As UInteger, dwhkl As IntPtr) As UInteger
End Function
<DllImport("user32.dll")> _
Private Shared Function GetKeyboardLayout(idThread As UInteger) As IntPtr
End Function
#Region "Enumerations"
Private Enum INPUTTYPE As UInteger
MOUSE = 0
KEYBOARD = 1
HARDWARE = 2
End Enum
<Flags()> _
Private Enum KEYEVENTF As UInteger
EXTENDEDKEY = &H1
KEYUP = &H2
SCANCODE = &H8
UNICODE = &H4
End Enum
#End Region
#Region "Structures"
<StructLayout(LayoutKind.Explicit)> _
Private Structure INPUTUNION
<FieldOffset(0)> Public mi As MOUSEINPUT
<FieldOffset(0)> Public ki As KEYBDINPUT
<FieldOffset(0)> Public hi As HARDWAREINPUT
End Structure
Private Structure INPUT
Public type As Integer
Public U As INPUTUNION
End Structure
Private Structure MOUSEINPUT
Public dx As Integer
Public dy As Integer
Public mouseData As Integer
Public dwFlags As Integer
Public time As Integer
Public dwExtraInfo As IntPtr
End Structure
Private Structure KEYBDINPUT
Public wVk As UShort
Public wScan As Short
Public dwFlags As UInteger
Public time As Integer
Public dwExtraInfo As IntPtr
End Structure
Private Structure HARDWAREINPUT
Public uMsg As Integer
Public wParamL As Short
Public wParamH As Short
End Structure
#End Region
#End Region
End Class
Code:
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Dim fgWin = GetForegroundWindow()
Dim fgPid As New Integer()
GetWindowThreadProcessId(fgWin, fgPid)
Dim proc = System.Diagnostics.Process.GetProcessById(fgPid)
If (proc.ProcessName = "bout.dat") Then
InputHelper.PressKey(Keys.F8, True)
End If
End Sub
if i send letters or numbers both are working with no problems but not Function keys
to make sure i have tried windows 7 On screen keyboard it can send Function keys
also i tried some free virtual keyboard all can send numbers and letters but not Function keys
except This it is like windows 7 OSK both can send Function keys to the game
sorry for this long story but i want it to be clear
My question : is there any code (VB2010) that can send Function keys to the game like windows 7 OSK ?
Also : Why Windows 7 OSK and >>> can send Function keys to the game and there are some other free virtual keyboard can't send Function keys
@ you should really describe your problem in detail and maybe even create your own thread. Nobody can help you if you don't explain what you are doing and what exactly is not working.
@ you should really describe your problem in detail and maybe even create your own thread. Nobody can help you if you don't explain what you are doing and what exactly is not working.
I will write a more detailed ticket to the support all right.
But you ignore this insults and racism ?
A moderator has to take action instead of just watching seriously.
Calm your **** down people.
We have give him the solutions, its up to him to figure it out on his own.
I have answered him at M.p.g.h.net already with the same thread and further explained HOW to use my function.
The only insult was "Fkin germans" guess what? I'm german.
This is just typical behavior of germans. Complaining without giving any information that could even help remotely. I'm out. Good luck, not going to reply to you again, you need to grow up.
Look at your behavior before you complain about mine.
^ No information
^ No information, playing on my previous statement with an idiotic adaptation
^ No information, insulting, idiotic claim. If you use windows, this code works - if you don't and you try to copy paste this code, you're plain stupid. There is no way it doesn't work for you. Implement it correctly.
your comment was racist anyway
also I wrote a ticket from the beginning but got no respone so I complained in this thread. guess you just dont have enough brain cells to understand that and try to cover it with insults
Interesting subject...Well, this game is using SetWindowsHookEx to hook the keyboard inputs and I think they are using this to "protect" the game against non-human inputs.
Send packet function (ASM) in game 03/05/2016 - AutoIt - 8 Replies I have an ASM code :
PUSHAD()
MOV_ECX(CALL_PACKET)
MOV_EAX(Address) // packet array
PUSH_EAX()
MOV_EDX(0X0048D330)
CALL_EDX()
POPAD()
RET()
std::function of a function returning an std::function 11/11/2013 - C/C++ - 19 Replies Nun muss ich nach langer Zeit auch mal wieder einen Thread erstellen, weil mir Google nicht mehr weiterhelfen kann.
Ich verzweifle an Folgendem Vorhaben:
#include <Windows.h>
#include <string>
#include <iostream>
using namespace std;
Running Function 2 after Function 1 finished 09/15/2013 - AutoIt - 3 Replies Hey, its me again.
Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all.
The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run.
#AutoIt3Wrapper_UseX64=n...
[VIP-function] ToxicSYS [VIP-function] 08/14/2010 - WarRock Hacks, Bots, Cheats & Exploits - 1 Replies heeeey E-pvpers :pimp:
this is a new hack by TSYS
Status : UNDETECTED
Functions (VIDEO) :
YouTube - WarRock - Bikini event VIP hack
Hshield send function hook 10/11/2008 - Kal Online - 12 Replies ey kann mir wer nen tipp geben wie man die addressen rauskriegt von int vom hshield für recv und send funktion damit die gehooked wird??