 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
squrrilslayer Master Cheater
Reputation: 0
Joined: 26 Dec 2006 Posts: 323
|
Posted: Tue Mar 10, 2009 3:44 am Post subject: [vb.net 2005] Sending inputs into minimized window |
|
|
Hey guys. been a while...
anyway, im trying to make a small bot for the newly released MMORPG "Darkfall" which can be done minimized. Currently im using event args and am trying to play around with postmessage.
I however can't get it to send anything whilst the window is not in focus thus no chance with minimization.
I know there have been some things done in maplestory a LONG time ago, and was hoping that someone could help me out here now.
Thanks.
_________________
|
|
| Back to top |
|
 |
kosstr12 Master Cheater
Reputation: -1
Joined: 12 Jul 2008 Posts: 339
|
Posted: Tue Mar 10, 2009 5:08 pm Post subject: |
|
|
| Will "DarkFall" Be part of the bot, or are the bot and DarkFall two separate programs?
|
|
| Back to top |
|
 |
squrrilslayer Master Cheater
Reputation: 0
Joined: 26 Dec 2006 Posts: 323
|
Posted: Tue Mar 10, 2009 6:14 pm Post subject: |
|
|
separate due to the fact i don't not have ANY experience or knowledge with 'injected' bots.
_________________
|
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Wed Mar 11, 2009 12:42 am Post subject: |
|
|
show us your code. it would probably be a problem with your hwnd. postmessage should work no matter what state the window's in.
_________________
|
|
| Back to top |
|
 |
squrrilslayer Master Cheater
Reputation: 0
Joined: 26 Dec 2006 Posts: 323
|
Posted: Wed Mar 11, 2009 1:49 am Post subject: |
|
|
I'll post only relevant code:
My declares:
| Code: | Private Declare Auto Function SendMessage Lib "user32.dll" Alias "SendMessage" _
(ByVal hWnd As IntPtr, ByVal Msg As Integer, _
ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
Const BM_CLICK As Integer = &HF5
Dim theHandle As IntPtr |
what i try to send (tested this into notepad)
| Code: | SendMessage(theHandle, BM_CLICK, 0, IntPtr.Zero)
SendMessage(theHandle, "Testing", 0, IntPtr.Zero) |
(handle was found via winID)
_________________
|
|
| Back to top |
|
 |
SXGuy I post too much
Reputation: 0
Joined: 19 Sep 2006 Posts: 3551
|
Posted: Wed Mar 11, 2009 4:05 am Post subject: |
|
|
You said you been messing around with postmessage but your source shows your using sendmessage, there two different functions.
You need PostMessage not SendMessage.
BOOL PostMessage( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
SendMessage, sends the message to the window (hense why it doesnt work as its minimized, and PostMessage posts it to the message queue associated with the Handle.
|
|
| Back to top |
|
 |
squrrilslayer Master Cheater
Reputation: 0
Joined: 26 Dec 2006 Posts: 323
|
Posted: Wed Mar 11, 2009 4:28 am Post subject: |
|
|
whops! Big error on my half >.<;
I'll change that up and see what happens!
_________________
|
|
| Back to top |
|
 |
SXGuy I post too much
Reputation: 0
Joined: 19 Sep 2006 Posts: 3551
|
Posted: Wed Mar 11, 2009 4:33 am Post subject: |
|
|
| thats ok, its only a little mistake, judging by your code, you just need to change the function name lol
|
|
| Back to top |
|
 |
squrrilslayer Master Cheater
Reputation: 0
Joined: 26 Dec 2006 Posts: 323
|
Posted: Wed Mar 11, 2009 5:16 am Post subject: |
|
|
| Code: | Public Class Form1
Private Declare Auto Function PostMessage Lib "user32.dll" Alias "PostMessage" (ByVal hWnd As IntPtr, ByVal Msg As String, _
ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
Dim TheHandle As IntPtr
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TheHandle = CType(Integer.Parse(TextBox1.Text, Globalization.NumberStyles.HexNumber), IntPtr)
PostMessage(Handle, "Testing", 0, 0)
End Sub
End Class
|
Well... that doesnt work for me, nothing happens.
How do i find the handle without using WinID?
_________________
|
|
| Back to top |
|
 |
SXGuy I post too much
Reputation: 0
Joined: 19 Sep 2006 Posts: 3551
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Wed Mar 11, 2009 8:05 am Post subject: |
|
|
well you'd probly have to declare it and so on....example
this is how you do it in c++
HWND myhWnd = FindWindow ("ClassNameHere" , "WindowNameHere")
then in postmessage..
PostMessage(myhWnd, etc , etc , etc)
just google it you'll probly get tons of results
EDIT: Hot Dam thnx for catching that FullyAwesome, made me lol
_________________
Last edited by manc on Thu Mar 12, 2009 12:01 am; edited 1 time in total |
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Wed Mar 11, 2009 11:44 pm Post subject: |
|
|
for getting the hwnd, like others mentioned, you use FindWindow (watch your spelling manc)
i think this is how you declare it in vb.net:
| Code: | | Public Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName as string, ByVal lpWindowName as string) As IntPtr |
then you can just have an intptr variable to hold the hwnd for you, and use that with postmessage.
so hwnd = FindWindow(...., ....)
_________________
|
|
| Back to top |
|
 |
squrrilslayer Master Cheater
Reputation: 0
Joined: 26 Dec 2006 Posts: 323
|
Posted: Thu Mar 12, 2009 5:23 am Post subject: |
|
|
dam got home late, buggered like hell... im going to try this tomorrow night.
thanks for the help so far though!
ok, i have this:
(commented code have a ' infront of it. eg 'msgbox("hello") is commented code)
| Code: |
Public Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Private Declare Auto Function PostMessage Lib "user32.dll" Alias "PostMessage" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, _
ByVal lParam As String) As IntPtr
Private Declare Auto Function SendMessage Lib "user32.dll" Alias "SendMessage" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, _
ByVal lParam As Integer) As IntPtr
Declare Auto Function mouse_event Lib "user32.dll" (ByVal dwflags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal dwData As Integer, ByVal dwExtraInfo As Integer) As Integer
Const MOUSEEVENTF_LEFTDOWN As Integer = 2
Const MOUSEEVENTF_LEFTUP As Integer = 4
Private Declare Auto Function FindWindowEx Lib "user32" _
(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, _
ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
Private Const WM_SETTEXT As Integer = &HC
Dim TheHandle As IntPtr
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'TheHandle = CType(Integer.Parse(TextBox1.Text, Globalization.NumberStyles.HexNumber), IntPtr)
'TheHandle = FindWindow("Notepad", "Test.txt - Notepad")
Dim NotepadHandle As IntPtr
'NotepadHandle = FindWindow("Notepad", "Test.txt - Notepad") 'Works on Test.exe notepad
NotepadHandle = FindWindow("WindowsForms10.Window.8.app.0.378734a", "Form1")
Dim EDITChildHandle As IntPtr
'EDITChildHandle = FindWindowEx(NotepadHandle, IntPtr.Zero, "Edit", String.Empty) 'Works on Test.exe notepad
EDITChildHandle = FindWindowEx(NotepadHandle, IntPtr.Zero, "WindowsForms10.EDIT.app.0.378734a", String.Empty) 'Works sending into click tester app counterbox
EDITChildHandle = FindWindowEx(NotepadHandle, IntPtr.Zero, "WindowsForms10.Window.8.app.0.378734a", "4")
SendMessage(EDITChildHandle, WM_SETTEXT, IntPtr.Zero, MOUSEEVENTF_LEFTDOWN)
SendMessage(EDITChildHandle, WM_SETTEXT, IntPtr.Zero, MOUSEEVENTF_LEFTUP)
'PostMessage(EDITChildHandle, WM_SETTEXT, IntPtr.Zero, "Testing")
PostMessage(EDITChildHandle, MOUSEEVENTF_LEFTDOWN, 0, 0)
PostMessage(EDITChildHandle, MOUSEEVENTF_LEFTUP, 0, 0)
|
for some reason, send message works when im sending text, but does not send clicks, and postmessage just does not work.
_________________
|
|
| Back to top |
|
 |
Iron Expert Cheater
Reputation: 0
Joined: 28 Mar 2006 Posts: 130
|
Posted: Tue Mar 31, 2009 1:21 pm Post subject: |
|
|
Direct-X input. The various forms of input can be handled differently. Clicking and movement is most likely handled by direct-x input, or whatever it's called.
_________________
|
|
| 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
|
|