| View previous topic :: View next topic |
| Author |
Message |
redhead Cheater
Reputation: 0
Joined: 21 Mar 2007 Posts: 47
|
Posted: Tue Apr 17, 2007 10:13 am Post subject: How to send letters or texts to a minimized programm |
|
|
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 |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Tue Apr 17, 2007 10:22 am Post subject: |
|
|
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 |
|
 |
redhead Cheater
Reputation: 0
Joined: 21 Mar 2007 Posts: 47
|
Posted: Tue Apr 17, 2007 12:08 pm Post subject: |
|
|
| 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 |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Tue Apr 17, 2007 12:20 pm Post subject: |
|
|
| 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 |
|
 |
redhead Cheater
Reputation: 0
Joined: 21 Mar 2007 Posts: 47
|
Posted: Tue Apr 17, 2007 1:09 pm Post subject: |
|
|
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 |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Tue Apr 17, 2007 2:48 pm Post subject: |
|
|
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 |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Tue Apr 17, 2007 3:36 pm Post subject: |
|
|
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 |
|
 |
--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?
|
Posted: Sat Jun 02, 2007 5:06 am Post subject: |
|
|
So by using this, I could make a keylogger to get my sisters password.
_________________
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 |
|
 |
|