change other program's caption

I wasnt to change other program's caption to other name. for example, if program's caption is ICQ, i want to change to other name, how can i do it? use DDE? or use other method? can u teach me?
skymouseAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RadlerCommented:
This algorithm works at NT only:
-Use FindWindow to catch the window handle of the other app
....HWnd:=FindWindow( "OldCaption", nil );
- Use SendMessage( HWnd, WM_SETTEXT, 0, integer( @NeCaption ) ).

T++, Radler.
PeterLarsenCommented:
This works at Win95 too.

procedure TForm1.Button1Click(Sender: TObject);
var
 Win : hwnd;
 s : string;
begin
 S:='NewName'+chr(0);
 SendMessage(FindWindow(nil, '38059115'), WM_SetText, 0, integer(@S[1]));
end;

Regards
Peter

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skymouseAuthor Commented:
I tried it, it worked, thanx~

Can u help me again?
if i dont want to change icq caption only, want to change any active window, how can i find out the active window then change the caption?

thanxxxxxxxxxxxx
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

PeterLarsenCommented:
How about accepting the answer and then add a new question :-)
intheCommented:
procedure TForm1.Button1Click(Sender: TObject);
var
h:hwnd;
s : string;
begin
s := 'hello';
h :=getforegroundwindow;
sendmessage(h,wm_settext,0,longint(s));
end;
skymouseAuthor Commented:
hmm.............i should close the old question and open a new one, sorry PeterLarsen, what can i do?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.