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?
 
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
0
 
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.
0
 
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
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
PeterLarsenCommented:
How about accepting the answer and then add a new question :-)
0
 
intheCommented:
procedure TForm1.Button1Click(Sender: TObject);
var
h:hwnd;
s : string;
begin
s := 'hello';
h :=getforegroundwindow;
sendmessage(h,wm_settext,0,longint(s));
end;
0
 
skymouseAuthor Commented:
hmm.............i should close the old question and open a new one, sorry PeterLarsen, what can i do?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.