procedure TMainForm.act_AddBookmarkExecute(Sender: TObject);
var
hwnd, chwnd : THandle;
p :
array[0..256]
of Char;
begin
hwnd := FindWindow(
nil,
nil);
GetClassName(hwnd, P, SizeOf(P));
while hwnd <> 0
do begin
hwnd := GetWindow(hwnd, GW_HWNDNEXT);
GetClassName(hwnd, P, SizeOf(P));
{****
* Firefox
****}
if string(P) = '
MozillaUIWindowClass'
then begin
// Fenstertitel holen
GetWindowText(hwnd, P, 255);
site_Desc := P;
// Url holen
chwnd := FindWindowEx(hwnd, 0, '
MozillaWindowClass',
nil);
SendMessage(chwnd, WM_GETTEXT, SizeOf(P), Integer(@P));
site_Url :=
string(P);
ShowMessage('
Firefox : '+site_Desc+#13#10+site_Url);
end;
{****
* Internet Explorer
****}
if string(P) = '
IEFrame'
then begin
// Fenstertitel holen
GetWindowText(hwnd, P, 255);
site_Desc := P;
// Url holen
chwnd := FindWindowEx(hwnd, 0, '
WorkerW',
nil);
chwnd := FindWindowEx(chwnd, 0, '
ReBarWindow32',
nil);
chwnd := FindWindowEx(chwnd, 0, '
ComboBoxEx32',
nil);
SendMessage(chwnd, WM_GETTEXT, SizeOf(P), Integer(@P));
site_Url :=
string(P);
ShowMessage('
IE : '+site_Desc+#13#10+site_Url);
end;
{****
* Opera
****}
if string(P) = '
OpWindow'
then begin
// Fenstertitel holen
GetWindowText(hwnd, P, 255);
site_Desc := P;
// Url holen
chwnd := FindWindowEx(hwnd, 0, '
OperaWindowClass',
nil);
SendMessage(chwnd, WM_GETTEXT, SizeOf(P), Integer(@P));
site_Url :=
string(P);
ShowMessage('
Opera : '+site_Desc+#13#10+site_Url);
end;
end;
end;