Link to home
Create AccountLog in
Avatar of Greenandroid
Greenandroid

asked on

Rename Window : Easy Question

I know there is an easy solution to this, but again, lost it when i reformatted my comp. (i can't figure out how i did it before).

I have been using this bit of code below to find if a window is open with a certain name :

var
h: HWND;
begin
h := FindWindow(nil,'Untitled - Notepad'); //find window
if IsWindow(h) then begin
.......
end;

I need to know how to RENAME the window name if that particular window name exists... For my example above, if a window with the name 'Untitled - Notepad' is found, it will rename it to 'My Sentence' for example.
ASKER CERTIFIED SOLUTION
Avatar of ZhaawZ
ZhaawZ
Flag of Latvia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Greenandroid
Greenandroid

ASKER

Ok can everyone ignore this question, as i have just found the solution myself..

If anyone else is interested, its

var
h: HWND;
begin
h := FindWindow(nil,'Untitled - Notepad'); //find window
if IsWindow(h) then begin
SetWindowText(h,PAnsiChar('hello'));
end;
end;

CAN I REQUEST THAT THIS TOPIC IS CLOSED
ok you must have submitted your solution whilst i was typing mine.. what a strange case of timing...

But saves me having to get the post closed...
You may have the points!