Keeping people off your back

Started by
15 comments, last by Muzlack 22 years ago
I think the reason for this is that SetWindowsText does not change textbox text.
--Muzlack
Advertisement
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.
---visit #directxdev on afternet <- not just for directx, despite the name
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.
---visit #directxdev on afternet <- not just for directx, despite the name
Ok, so lets say I do a SendMessage:
SendMessage(h, WM_SETTEXT, ?, ?);
What would the wparam and lparam be?
--Muzlack
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.
--Muzlack
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 .
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.

This topic is closed to new replies.

Advertisement