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 


How do i send a keystroke to Notepad using delphi?

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

Joined: 20 Apr 2007
Posts: 668

PostPosted: Thu Jan 10, 2008 1:15 pm    Post subject: How do i send a keystroke to Notepad using delphi? Reply with quote

Hi,

I was wondering if it was possible to make a program in delphi, wich when you click a button, i will write, lets say a "K", in a notepad
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Thu Jan 10, 2008 1:37 pm    Post subject: Reply with quote

You can use the sendkeys function.
Include the .pas file from attachment in your project, or put the .dcu in your lib folder.



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.

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

Joined: 16 May 2007
Posts: 214
Location: The Netherlands

PostPosted: Thu Jan 10, 2008 1:43 pm    Post subject: Reply with quote

procedure TForm1.Button1Click(Sender: TObject);
begin
AppActivate('Notepad - Untitled');
sleep(0);
sendkeys ('you fail' ,true);
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Thu Jan 10, 2008 2:13 pm    Post subject: Reply with quote

AWESOME! ty!

but i edited the code a little:

procedure TForm1.Button1Click(Sender: TObject);
begin
AppActivate('Notepad - Untitled');
sleep(0);
sendkeys ('woot, it works!' ,true);

Cool

is there a way to do this, without setting notepad as an active window?
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Thu Jan 10, 2008 2:51 pm    Post subject: Reply with quote

PostMessage/ SendMessage.
Back to top
View user's profile Send private message
iRiot
Master Cheater
Reputation: 0

Joined: 03 Jul 2007
Posts: 395
Location: Aka RIOT

PostPosted: Thu Jan 10, 2008 7:02 pm    Post subject: Reply with quote

Here is the code to send a keystroke in delphi..just add edit1.text onto your form

Code:
var
i : integer;
begin
for i := 1 to Length(Edit1.text) do
Postmessage(FindWindowex(FindWindow(nil,'Untitled - Notepad'),0,nil,nil),WM_Char,integer(pChar(Edit1.text[i])),1);
end;


Also if u wanted to press enter....

Code:
PostMessage(FindWindowex(FindWindow(nil,'Untitled - Notepad'),0,nil,nil),WM_KEYDOWN , $0D, 0);


Complete code... Omg u just made a auto spammer just add this code to a timer and set the interval as 1...

Code:
var
i : integer;
begin
for i := 1 to Length(Edit1.text) do
Postmessage(FindWindowex(FindWindow(nil,'Untitled - Notepad'),0,nil,nil),WM_Char,integer(pChar(Edit1.text[i])),1);
PostMessage(FindWindowex(FindWindow(nil,'Untitled - Notepad'),0,nil,nil),WM_KEYDOWN , $0D, 0);
end;

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

Joined: 20 Apr 2007
Posts: 668

PostPosted: Fri Jan 11, 2008 5:06 am    Post subject: Reply with quote

AWESOME!, ty guys! well... im at school right now, gonna check it l8er

edit: yea, it hell works! Very Happy now, is there a way to "bypass" that into maplestory?

and, what if i want to make a left mouse click?
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