System Delphi

Title: Setting the caption of other windows
Question: I'm hooking into windows, and wish to change the caption of the titlebar to reflect that I am modifying its behaviour. How can I do this?
Answer:
Code:
setlength(wndtext, 78);
GetWindowText(pMouse.hwnd, PChar(wndtext), 78);
if pos('with added MyApp functionality', wndtext) = 0 then
begin
wndtext := copy(wndtext, 1, pos(#0, wndtext) - 1);
SetWindowText(pMouse.hwnd, PChar(wndtext + ' - with added MyApp functionality'));
end;
Additional Info:
pMouse.hwnd is the window handle.
78 is the max length of a title bar caption.
wndtext is a normal string.
I got the window handle from hooking in WH_MOUSE, the info which it provides on the window being manipulated can be got like so:
function MouseHookProc(Code: integer; Msg: WParam; MouseHook: Pointer): LResult; stdcall;
var
pMouse: ^MOUSEHOOKSTRUCT;
begin
pMouse := MouseHook;
.
.
The code supplied here works fine on d5 and win2k, and should work fine on all other 32 bit windows and delphi versions.