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 


PostMessage
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
xAznxStylezx
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 113

PostPosted: Thu Dec 06, 2007 3:46 pm    Post subject: PostMessage Reply with quote

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

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Dec 06, 2007 4:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
xAznxStylezx
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 113

PostPosted: Thu Dec 06, 2007 4:08 pm    Post subject: Reply with quote

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

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Dec 06, 2007 4:22 pm    Post subject: Reply with quote

maybe they use direct input which would mean no posting messages because they respond to dinput not msgs
_________________
Back to top
View user's profile Send private message
xAznxStylezx
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 113

PostPosted: Thu Dec 06, 2007 4:26 pm    Post subject: Reply with quote

But then how could using postmessage with return, f1, f2 ,f3, etc work? Shocked
_________________
白人看不懂

Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Dec 06, 2007 4:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
xAznxStylezx
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 113

PostPosted: Thu Dec 06, 2007 4:54 pm    Post subject: Reply with quote

I'm still in the process of learning Delphi, but what would GetLastError do?
_________________
白人看不懂

Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Dec 06, 2007 5:04 pm    Post subject: Reply with quote

it would Get the Last Error

try googling it before askig >.<

_________________
Back to top
View user's profile Send private message
xAznxStylezx
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 113

PostPosted: Thu Dec 06, 2007 5:22 pm    Post subject: Reply with quote

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

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Thu Dec 06, 2007 5:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
xAznxStylezx
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 113

PostPosted: Thu Dec 06, 2007 6:28 pm    Post subject: Reply with quote

Don't directX games usually only have one hwnd?
_________________
白人看不懂

Back to top
View user's profile Send private message
Lewiathan
How do I cheat?
Reputation: 0

Joined: 06 Dec 2007
Posts: 5

PostPosted: Fri Dec 07, 2007 1:23 am    Post subject: Re: PostMessage Reply with quote

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
Quote:
PostMsg(...);

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
View user's profile Send private message
kebin25
Newbie cheater
Reputation: 0

Joined: 07 Dec 2007
Posts: 11

PostPosted: Fri Dec 07, 2007 2:41 am    Post subject: Reply with quote

Wow neat stuff, dman you guys are smart haha nerddddyyy

Cool stuff thanks it gave me some teachings
Back to top
View user's profile Send private message
xAznxStylezx
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 113

PostPosted: Fri Dec 07, 2007 5:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Fri Dec 07, 2007 5:09 pm    Post subject: Reply with quote

WM_KEYDOWN
Take a look at the bits. Bits go from right to left. (Ascending order.)

_________________
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
Goto page 1, 2  Next
Page 1 of 2

 
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