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 to send letters or texts to a minimized programm

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

Joined: 21 Mar 2007
Posts: 47

PostPosted: Tue Apr 17, 2007 10:13 am    Post subject: How to send letters or texts to a minimized programm Reply with quote

Hey all,
I know basics in C++ and I'm beginner at win32 programming.
My Questions is, how can I send keys to a Programm that is minimized?
I know how to simulate a letter, so its like I use the Keyboard.
But now I want to send the letters to a Programm, without simulating the Keyboard.So I can do something else in the Time, my Programm is typing a text or something to another Programm.
For example, if some1 could help me making a Program that writes a Text to notebook (from windows), and notebook is minized all the time, I would be very glad.
I hope some1 can help me.
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Tue Apr 17, 2007 10:22 am    Post subject: Reply with quote

1) Get handle to the window ("HWND")
2) Send the WM_CHAR message to it

Please don't try this on a protected game and say it doesn't work.
Back to top
View user's profile Send private message
redhead
Cheater
Reputation: 0

Joined: 21 Mar 2007
Posts: 47

PostPosted: Tue Apr 17, 2007 12:08 pm    Post subject: Reply with quote

I didn`t understand what you mean.I googled for WM_CHAR but didn't find something that really helps me.Can you pls write an example?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Tue Apr 17, 2007 12:20 pm    Post subject: Reply with quote

Code:

#include <windows.h>
#include <stdio.h>

//
//Example of sending a message to notepad.
//

int main(int argc, char * argv[])
{
    HWND hNotepad; int i;
    char * Message = "Hello, redhead!";
   
    hNotepad = FindWindowEx(FindWindow("Notepad", NULL), 0, "Edit", 0);
    if (hNotepad == NULL) {
       return 1;
    } else {
       for (i = 0; i < lstrlen(Message); i++)
           SendMessage(hNotepad, WM_CHAR, Message[i], 0);
    }
   
    puts("Message Sent.");
    getch();
    return 0;
}
Back to top
View user's profile Send private message
redhead
Cheater
Reputation: 0

Joined: 21 Mar 2007
Posts: 47

PostPosted: Tue Apr 17, 2007 1:09 pm    Post subject: Reply with quote

Thx, works great.
But I've got 2 more Questions.
What do I have to write when I want the program to send "enter" or F1 or something like that.
The 2. Question is, is there a way to read what is written in the notepad?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Tue Apr 17, 2007 2:48 pm    Post subject: Reply with quote

get the virtual key code, there is a list here

and yes you can read from it, dont have the method off hand though
Back to top
View user's profile Send private message
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Tue Apr 17, 2007 3:36 pm    Post subject: Reply with quote

You should be able to get the text by getting the edit control's handle using appal's sample code, then sending WM_GETTEXT to the control.

Edit: somehow linking to msdn pages doesn't work, so just google WM_GETTEXT.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
--Pillboi--
Grandmaster Cheater Supreme
Reputation: 0

Joined: 06 Mar 2007
Posts: 1383
Location: I don't understand the question. Is this a 1 to 10 thing?

PostPosted: Sat Jun 02, 2007 5:06 am    Post subject: Reply with quote

So by using this, I could make a keylogger to get my sisters password. Razz
_________________

Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair.
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