Sending X Keys to a program with a button

Posts 17 of 7 · Page 1 of 1
Sending X Keys to a program with a button
How do I send X keys every X seconds to a game?

Help appreciated ~~
Maybe this could help:
www vbforums com/showthread.php?620479-SendKey-to-other-process
Well It kinda worked, thanks!
But however the game doesn't recognize the input so it doesn't really do what I want it to.
Le bump is bump
Try the SendKeys.Send function (not sure if you already did it). If that doesn't work try to import and use the keybd_event / mouse_event API from the user32.dll.
I could be wrong about this if SendKeys.Send somewhere calls the same API so it won't work for you doing that as well then.
Quote Originally Posted by M.P.G.HCapShop View Post
Try the SendKeys.Send function (not sure if you already did it). If that doesn't work try to import and use the keybd_event / mouse_event API from the user32.dll.
I could be wrong about this if SendKeys.Send somewhere calls the same API so it won't work for you doing that as well then.
Im having the same problem.
Where can I find "user32.dll"?
Quote Originally Posted by bamb0ula View Post
Im having the same problem.
Where can I find "user32.dll"?
In your system folder: (generally) C:\Windows\system32 , but you don't need to look at the file (lol?)...just make the correct declaration in your code and the compiler will (try to) automatically find it.

2 sources you should check:

1. msdn -- to check the function's return type, and the argument(s) type(s). And general notes about the function.
2. pinvoke -- to see an example of the function declaration.


https://www.google.com/search?q=keyb..._event+pinvoke --> http://www.pinvoke.net/default.aspx/user32.keybd_event
C# Signature:

[DllImport("user32.dll")]
static extern bool keybd_event(byte bVk, byte bScan, uint dwFlags,
UIntPtr dwExtraInfo);

or

[DllImport("user32.dll")]
static extern bool keybd_event(byte bVk, byte bScan, uint dwFlags,
int dwExtraInfo);

VB.NET Signature:

<DllImport("user32.dll")> _
Private Shared Function keybd_event(bVk As Byte, bScan As Byte, dwFlags As UInteger, dwExtraInfo As UIntPtr) As Boolean
End Function

or

<DllImport("user32.dll")> _
Private Shared Function keybd_event(bVk As Byte, bScan As Byte, dwFlags As UInteger, dwExtraInfo As Integer) As Boolean
End Function

or

<DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall, _
CharSet:=CharSet.Unicode, EntryPoint:="keybd_event", _
ExactSpelling:=True, SetLastError:=True)> _
Public Shared Function keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Int32, ByVal dwExtraInfo As Int32) As Boolean
End Function

(..more..)
https://www.google.com/search?q=keybd_event+msdn -->https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx

VOID WINAPI keybd_event(
_In_ BYTE bVk,
_In_ BYTE bScan,
_In_ DWORD dwFlags,
_In_ ULONG_PTR dwExtraInfo
);
Posts 17 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?