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 


[Delphi] Translatemessage / Dispatchmessage

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

Joined: 08 Aug 2006
Posts: 929

PostPosted: Sun Nov 11, 2007 2:05 pm    Post subject: [Delphi] Translatemessage / Dispatchmessage Reply with quote

I tried making a gui application that can tran/disp a message to a window/
i came up with this code, but it doesnt work. Can someone tell me whats wrong?

Code:

procedure TForm1.Button1Click(Sender: TObject);
var
MSG : TMSG;
begin
ZeroMemory(@Msg, sizeof(MSG));
Msg.hwnd := FindWindow(PCHAR(Edit1.text),NIL);
Msg.lParam :=  (MapVirtualKey(Cardinal(edit2.text),0));
Msg.message := WM_KEYDOWN;
Msg.wParam := strtoint(edit3.text);
TranslateMessage(Msg);
DispatchMessage(Msg);
Msg.message := WM_KEYDOWN;
TranslateMessage(Msg);
DispatchMessage(Msg);

end;
Back to top
View user's profile Send private message AIM Address MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sun Nov 11, 2007 2:10 pm    Post subject: Reply with quote

Rolling Eyes

check return values
check last error
check for exceptions

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

Joined: 08 Aug 2006
Posts: 929

PostPosted: Sun Nov 11, 2007 6:04 pm    Post subject: Reply with quote

there werent any errors, exceptions, but i dont know how to check the return values :X
Back to top
View user's profile Send private message AIM Address MSN Messenger
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sun Nov 11, 2007 6:09 pm    Post subject: Reply with quote

slippppppppp wrote:
there werent any errors, exceptions, but i dont know how to check the return values :X

oh gawd. Laughing Then you obviously don't even know what functions do.

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

Joined: 08 Aug 2006
Posts: 929

PostPosted: Sun Nov 11, 2007 6:10 pm    Post subject: Reply with quote

someone tell me instead of giving me their opinions on making me look stupid Embarassed
Back to top
View user's profile Send private message AIM Address MSN Messenger
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sun Nov 11, 2007 6:26 pm    Post subject: Reply with quote

TranslateMessage:
Code:
Return Value

    If the message is translated (that is, a character message is posted to the thread's message queue), the return value is nonzero.

    If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the return value is nonzero, regardless of the translation.

    If the message is not translated (that is, a character message is not posted to the thread's message queue), the return value is zero.


DispatchMessage:
Code:
Return Value

    The return value specifies the value returned by the window procedure. Although its meaning depends on the message being dispatched, the return value generally is ignored.

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

Joined: 03 Oct 2006
Posts: 238

PostPosted: Mon Nov 12, 2007 5:23 am    Post subject: Reply with quote

Yout lParam is wrong. Check WM_KEYDOWN message at MSDN.
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