Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB.NET] PostMessage or SendMessage not working.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Mal1t1a
Cheater
Reputation: 0

Joined: 03 Jan 2010
Posts: 40

PostPosted: Wed Apr 27, 2011 7:46 pm    Post subject: [VB.NET] PostMessage or SendMessage not working. Reply with quote

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
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Apr 28, 2011 2:21 am    Post subject: Reply with quote

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
View user's profile Send private message
Radiation
Grandmaster Cheater
Reputation: 14

Joined: 17 Jun 2009
Posts: 842
Location: Chernobyl

PostPosted: Fri Apr 29, 2011 5:50 pm    Post subject: Reply with quote

Quote:
WM_CHAR


did you define the variables you are using?

_________________
Jesus loves you, Hitler! Smile

Playing/Embedding XM and MOD files in Visual Basic 6

.erutangis ruoy ni siht esu neht ,sdrawkcab siht daer ot hguone trams erew uoy fI
I can spell your name backwards: ‮Hitler
Back to top
View user's profile Send private message
InternetIsSeriousBusiness
Grandmaster Cheater Supreme
Reputation: 8

Joined: 12 Jul 2010
Posts: 1268

PostPosted: Fri Apr 29, 2011 9:44 pm    Post subject: Reply with quote

A chat for what? A game? If so what game and what is it coded in?
_________________
FLAME FLAME FLAME!!!@@@
Back to top
View user's profile Send private message
Mal1t1a
Cheater
Reputation: 0

Joined: 03 Jan 2010
Posts: 40

PostPosted: Tue May 10, 2011 9:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites