| View previous topic :: View next topic |
| Author |
Message |
xAznxStylezx Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 113
|
Posted: Thu Dec 06, 2007 3:46 pm Post subject: PostMessage |
|
|
When I use PostMessage (with sponge's hookHop.dll) and send a keystroke to a program, in this case GunBound, it doesn't recieve it. Although, when I use PostMessage to send the return key, F1,F2,etc, it works fine, but if I use the space bar, a, b, c, etc it has no action. Also, if i changed FindWindow to go to PinBall it works fine.
Here's what I have.
procedure TForm1.Timer2Timer(Sender: TObject);
begin
Wnd := findwindow('Softnyx','GunBound');
if wnd <>0 then begin
postMsg(Wnd, WM_KEYDOWN, ord(VK_SPACE),0);
end;
end;
Help would be greatly appreciated. _________________
白人看不懂
 |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Thu Dec 06, 2007 4:04 pm Post subject: |
|
|
| Code: | procedure TForm1.Timer2Timer(Sender: TObject);
begin
Wnd := FindWindow(NIL,'GunBound');
if Wnd <>0 then begin
postMsg(Wnd, WM_KEYDOWN, ord(VK_SPACE),0);
end;
end; |
Idk what the ClassName is so just use NIL and it should work. Idk if nil must be in '' so i didn't put it in them
Also use FindWindow not findwindow and if you declared Wnd don't use wnd _________________
|
|
| Back to top |
|
 |
xAznxStylezx Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 113
|
Posted: Thu Dec 06, 2007 4:08 pm Post subject: |
|
|
It doesn't have anything to do with the classname or FindWindow because if i use VK_RETURN it works, but if i use VK_SPACE, or any letters it has no effect. _________________
白人看不懂
 |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Thu Dec 06, 2007 4:22 pm Post subject: |
|
|
maybe they use direct input which would mean no posting messages because they respond to dinput not msgs _________________
|
|
| Back to top |
|
 |
xAznxStylezx Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 113
|
Posted: Thu Dec 06, 2007 4:26 pm Post subject: |
|
|
But then how could using postmessage with return, f1, f2 ,f3, etc work?  _________________
白人看不懂
 |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Thu Dec 06, 2007 4:36 pm Post subject: |
|
|
They MIGHT use hotkeys for those, i really don't know.
It doesn't seem that it wouldn't work
use GetLastError();
Post your program. _________________
|
|
| Back to top |
|
 |
xAznxStylezx Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 113
|
Posted: Thu Dec 06, 2007 4:54 pm Post subject: |
|
|
I'm still in the process of learning Delphi, but what would GetLastError do? _________________
白人看不懂
 |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Thu Dec 06, 2007 5:04 pm Post subject: |
|
|
it would Get the Last Error
try googling it before askig >.< _________________
|
|
| Back to top |
|
 |
xAznxStylezx Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 113
|
Posted: Thu Dec 06, 2007 5:22 pm Post subject: |
|
|
I mean, I know what it does, but what would it do to send the space key? Doesn't it only return a integer? _________________
白人看不懂
 |
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Thu Dec 06, 2007 5:46 pm Post subject: |
|
|
| GetLastError returns a value that is usually used to "diagnose" the error you are getting. If you are not getting an error with PostMessage, then check if there's anything selected to input (an editbox). Sending a key to Gunbound won't really do anything. Check if you selected an edit box in chat because then, it actually might type the key you sent. |
|
| Back to top |
|
 |
xAznxStylezx Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 113
|
Posted: Thu Dec 06, 2007 6:28 pm Post subject: |
|
|
Don't directX games usually only have one hwnd? _________________
白人看不懂
 |
|
| Back to top |
|
 |
Lewiathan How do I cheat?
Reputation: 0
Joined: 06 Dec 2007 Posts: 5
|
Posted: Fri Dec 07, 2007 1:23 am Post subject: Re: PostMessage |
|
|
| xAznxStylezx wrote: | When I use PostMessage (with sponge's hookHop.dll) and send a keystroke to a program, in this case GunBound, it doesn't recieve it. Although, when I use PostMessage to send the return key, F1,F2,etc, it works fine, but if I use the space bar, a, b, c, etc it has no action. Also, if i changed FindWindow to go to PinBall it works fine.
Here's what I have.
procedure TForm1.Timer2Timer(Sender: TObject);
begin
Wnd := findwindow('Softnyx','GunBound');
if wnd <>0 then begin
postMsg(Wnd, WM_KEYDOWN, ord(VK_SPACE),0);
end;
end;
Help would be greatly appreciated. |
Try:
1st. focus window, eg.:
| Code: | | SendMessage(wnd,WM_ACTIVATE,1,1); |
next
Wnd return nonzero value?
| xAznxStylezx wrote: | | Don't directX games usually only have one hwnd? |
Its good suggestion,
maybe needed handle for specified object in window, not for window ...
For iterate child objects of window, use enumchildwindows func. |
|
| Back to top |
|
 |
kebin25 Newbie cheater
Reputation: 0
Joined: 07 Dec 2007 Posts: 11
|
Posted: Fri Dec 07, 2007 2:41 am Post subject: |
|
|
Wow neat stuff, dman you guys are smart haha nerddddyyy
Cool stuff thanks it gave me some teachings |
|
| Back to top |
|
 |
xAznxStylezx Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 113
|
Posted: Fri Dec 07, 2007 5:06 pm Post subject: |
|
|
I've tried SendMessage(wnd,WM_ACTIVATE,1,1); but it changed nothing. I think it has something to do with what functions are being sent. I've been looking around to find some other ways to send keys, and I've come across SendInput, would it be possible to implement it into postMsg? I've tried postMsg(Wnd, SendInput(VK_SPACE,0,0,0),0,0); but when I compile it says "Type of actual and formal var parameters must be identical". I have no idea what that means. I've tried using keybd_event but on the microsoft site it says that it has been surpressed in windows 2000+ so it just ends up crashing the game. _________________
白人看不懂
 |
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Fri Dec 07, 2007 5:09 pm Post subject: |
|
|
WM_KEYDOWN
Take a look at the bits. Bits go from right to left. (Ascending order.) _________________
|
|
| Back to top |
|
 |
|