Archived

This topic is now archived and is closed to further replies.

Muzlack

Keeping people off your back

Recommended Posts

You know the worst part of game programming? Lets say you are working, and someone instant messanges you. There''s nothing I could do to make them leave me alone. So, what I was thinking was make a program to randomly key in one of 20 phrases every, oh, 30 seconds, so the conversation would look like: Someone: Hey! MuzlakOofmay: Hey man. Someone: How are you? MuzlakOofmay: What are you gonna do this weekend? Someone: Nothing much, but how are you? MuzlakOofmay: Ok. Someone: Did you go see Lord of the rings? MuzlakOofmay: k. Someone: Uhh, did you SEE it? MuzlakOofmay: What are you gonna do this weekend? Someone: what are you doing? MuzlakOofmay: I had a lot of pizza last night. Someone: Wanna hang out? MuzlakOofmay: k. Someone: Where should we meet? MuzlakOofmay: What are you gonna do this weekend? Someone: I ALREADY told you! MuzlakOofmay: Did you get all of your homework done? Someone: Ugh... This is really annoying, yes I did. MuzlakOofmay: I had a lot of pizza last night. Someone: I know! MuzlakOofmay: Really? Someone: YES! MuzlakOofmay: Sorry, that was my brother. Someone: Oh, that explains it. MuzlakOofmay: What are you gonna do this weekend? Someone signed off at 11:33 AM This would be awesome! Is there a way I can get a hold of the IM textbox? I''m not much into windows programming, I just know enough to get a simple application started for dx. But this would be awesome! It would make me able to free up a lot of time for game programming. Sponge Factory --Muzlack

Share this post


Link to post
Share on other sites
But that takes the mystery out of the whole thing. Then people would be mad at me, but this way, they''ll think I''m weird.

Share this post


Link to post
Share on other sites
quote:
Original post by Muzlack
You don''t understand! It is simply to be funny!

It''s not funny, it''s deadly serious! Won''t you please think of the children!!



For what it''s worth, I laughed .

Share this post


Link to post
Share on other sites
Take a look at FindWindow and SetWindowText. You can use Spy++ to get window class and title for the textbox of your favorite messenger. Or you can use hooks: SetWindowsHookEx.

Share this post


Link to post
Share on other sites
A guy at work wanted to write an IM Bot that would respond to his ex-girlf

uh-huh
yes I''m listening
no, I do care

Wouldn''t be so hard IMO


University is a fountain of knowledge, and students go there to drink.

Share this post


Link to post
Share on other sites
Indirectx, I am very close, I am using AIM, fyi, and I got the hwnd of the window, and I correctly changed its caption. Then when I used the spy++ finder, I tryed changing the caption of the textbox, and this failed, any clues?
My lines of code are currently:

HWND h=FindWindow("Ate32Class", "");
SetWindowText(h,"Hey Man!");


Sponge Factory
--Muzlack

Share this post


Link to post
Share on other sites
I should''ve read the docs more carefuly: "SetWindowText cannot change the text of a control in another application." Try WM_SETTEXT instead. Make sure you SendMessage it.

Share this post


Link to post
Share on other sites
The reason is that each process has its own address space. When you pass the window text to a function, you give it a pointer. In another process, this pointer points to (most likely) some unaccessible data. What are the chances of AIM''s process having the string "My new title" in its address space at the exact same memory location as it''s in your app''s address space?

This is why you can''t subclass windows from other process (that is, you can''s SetWindowLong(GWL_WNDPROC) if the window does not belong to your process). Windows does allow certain messages to cross process boundaries, for comparibility with Win16 code. I believe WM_SETTEXT is one of them. The "proper" way to send data to another process is with WM_COPYDATA.

There is a way do whatever you want with any process. To do this, you need to inject a dll into the address space of another process, and let the dll do the work. One way is to use hooks. A more interesting way would be to allocate memory in another process, copy your code into it, and execute it.

If you wonder where I got all of this, it''s from Jeffrey Richter''s "Advanced Windows" book. He also has sample programs that do what I''ve described here.

Share this post


Link to post
Share on other sites
Ok, well I guess this is a little far-fetched for me I guess. I''ll have to wait till I learn more about windows programming.

Share this post


Link to post
Share on other sites
Hey, c''mon now...it''s an easy program! Great to learn from. This link will help : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win32/catfunc_26m1.asp

This idea is wonderful. I love a good laugh and your post was just what I needed. I''ll help you as much as possible; don''t give up on it .

Share this post


Link to post
Share on other sites
Yeah, it''s quite easy; just have to do some searching for the right functions.

Also, you might want to store your random lines in text files so that you can load up different profiles for different people.

Share this post


Link to post
Share on other sites