 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Mal1t1a Cheater
Reputation: 0
Joined: 03 Jan 2010 Posts: 40
|
Posted: Wed Apr 27, 2011 7:46 pm Post subject: [VB.NET] PostMessage or SendMessage not working. |
|
|
First of all, is it even remotely possible to have PostMessage or SendMessage "press keys" inside of a Fullscreen game? I.e. use the Chat? (Requires the user to activate the chat box, type in the message, then send it, which is all done with the keyboard)
I've tried many different ways using WM_KEYDOWN and WM_CHAR, and nothing worked.
| Code: |
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, _
ByVal lParam As Any) As Long |
I call it like this:
| Code: | Dim myp = process.GetProcessByName("game")
SendMessage(myp(0).handle, WM_CHAR, 13, 1&) |
Same goes for PostMessage, 13 is the keycode for Enter, and 1& is how many times I want it to be pressed. WM_CHAR sends the Message as a Character.
I have tried the same as above with WM_KEYDOWN and chaning 1& to 0&
Anyone know?
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu Apr 28, 2011 2:21 am Post subject: |
|
|
| I don't code .NET but it looks like you're getting a process handle and trying to send a windows message to that ? You need to get a window handle instead.
|
|
| Back to top |
|
 |
Radiation Grandmaster Cheater
Reputation: 14
Joined: 17 Jun 2009 Posts: 842 Location: Chernobyl
|
Posted: Fri Apr 29, 2011 5:50 pm Post subject: |
|
|
did you define the variables you are using?
_________________
|
|
| Back to top |
|
 |
InternetIsSeriousBusiness Grandmaster Cheater Supreme
Reputation: 8
Joined: 12 Jul 2010 Posts: 1268
|
Posted: Fri Apr 29, 2011 9:44 pm Post subject: |
|
|
A chat for what? A game? If so what game and what is it coded in?
_________________
FLAME FLAME FLAME!!!@@@ |
|
| Back to top |
|
 |
Mal1t1a Cheater
Reputation: 0
Joined: 03 Jan 2010 Posts: 40
|
Posted: Tue May 10, 2011 9:25 pm Post subject: |
|
|
Sorry, yes my variables are defined. I did get the Window Handle, however, when using SendMessage or PostMessage, it won't send to the game. I test sending to Notepad, and to Command Prompt, and they both proved successful. When using VB.NET if the game is open (has focus), and is fullscreen (no other way to paly it currently). Using SendKeys.Sent("{ENTER}") works. Using SendKeys.SendWait("{enter}") works better. All I currently need, is to get the the Enter Button pressed, while the game is minimized. I found a very hacky way of open the chatbox, and typing a message, in the game.
There is a simple Boolean in the Game, that when set to true, it'll show the chatbox. I can set this boolean to be true by means of WriteProcessMemory. I can then proceed to Set the Text being written by using WriteProcessMemory (convert the message I want to type into bytes, then writing it). Now the only problem I'm having is to actually send the message. I can't just set the Boolean to false, as that just closes the chatbox and doesn't send the message. I tried SendMessage and PostMessage with the Window Handle.
| Code: | | Process.GetProcessesByName("game")(0).MainWindowHandle |
That's what I used for Command Prompt and when using SendMessage it worked flawlessly to send text and press enter.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|