2008. április 9., szerda
How to paint into another windows' caption bar
Problem/Question/Abstract:
How to paint into another windows' caption bar
Answer:
If you can get a handle to a Windows object, generally if it supports a WM_SETTEXT message (most windows do), then you can change the caption. The example below does just that:
procedure Form1.Button1Click(Sender: TObject);
begin
WinExec('notepad.exe', SW_SHOWNORMAL);
end;
procedure Form1.Button2Click(Sender: TObject);
var
hChild: HWND;
strNewTitle: string;
begin
hChild := FindWindow(nil, 'Untitled - Notepad');
if (hChild <> NULL) then
begin
strNewTitle := ' Funny name ';
SendMessage(hChild, WM_SETTEXT, 0, LPARAM(PChar(strNewTitle)));
end;
end;
Note that this was written in D5 and the FindWindow(...) function can be a little ornery in some instances (like case sensitivity and precise text makeup, see example).
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése