Форум: "WinAPI";
Текущий архив: 2005.06.29;
Скачать: [xml.tar.bz2];
ВнизПолучение текста из адресной строки explorera Найти похожие ветки
← →
balamutik © (2005-05-04 14:13) [0]Помогите кто-нить с этой проблемой.
Спасибо заранее!!!
← →
easy © (2005-05-04 15:18) [1]
function PrintEnumProc(Wnd: HWND; LParam: LPARAM): BOOL; stdcall;
const
MaxTextSize = 1024;
var
PrText: array[0..MaxTextSize] of char;
begin
Result := True; { continue enumerating }
windows.GetClassName(Wnd,PrText,MaxTextSize);
if PrText="Edit" then begin
SendMessage(Wnd, WM_GETTEXT, MaxTextSize, longint(@PrText));
TMemo(Pointer(LParam)^).Lines.Add(PrText);
Result:=false;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
W: HWND;
begin
Memo1.Clear;
W := FindWindow("ExploreWClass", nil);
if W = 0 then
raise Exception.Create("Explorer window not found");
EnumChildWindows(W, @PrintEnumProc, LPARAM(@memo1));
end;
← →
Dextor © (2005-05-04 15:41) [2]
function GetText(WindowHandle: hwnd): string;
var
txtLength: integer;
buffer: string;
begin
TxtLength := SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0);
txtlength := txtlength + 1;
setlength(buffer, txtlength);
sendmessage(WindowHandle, wm_gettext, txtlength, longint(@buffer[1]));
result := buffer;
end;
function GetURL: string;
var
ie, toolbar, combo,
comboboxex, edit,
worker, toolbarwindow: hwnd;
begin
ie := FindWindow(pchar("IEFrame"), nil);
worker := FindWindowEx(ie, 0, "WorkerA", nil);
toolbar := FindWindowEx(worker, 0, "rebarwindow32", nil);
comboboxex := FindWindowEx(toolbar, 0, "comboboxex32", nil);
combo := FindWindowEx(comboboxex, 0, "ComboBox", nil);
edit := FindWindowEx(combo, 0, "Edit", nil);
toolbarwindow := FindWindowEx(comboboxex, 0, "toolbarwindow32", nil);
result := GetText(edit);
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(GetURL);
end;
МОЖНО ЕЩЕ ТАК:uses windows, ddeman, ......
function Get_URL(Servicio: string): String;
uses windows, ddeman, ......
function Get_URL(Servicio: string): String;
var
Cliente_DDE: TDDEClientConv;
temp:PChar;
begin
Result := "";
Cliente_DDE:= TDDEClientConv.Create( nil );
with Cliente_DDE do
begin
SetLink( Servicio,"WWW_GetWindowInfo");
temp := RequestData("0xFFFFFFFF");
Result := StrPas(temp);
StrDispose(temp); //<<-Предотвращаем утечку памяти
CloseLink;
end;
Cliente_DDE.Free;
end;
procedure TForm1.Button1Click(Sender);
begin
showmessage(Get_URL("Netscape"));
или
showmessage(Get_URL("IExplore"));
end;
← →
Dextor © (2005-05-04 15:42) [3]
function GetText(WindowHandle: hwnd): string;
var
txtLength: integer;
buffer: string;
begin
TxtLength := SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0);
txtlength := txtlength + 1;
setlength(buffer, txtlength);
sendmessage(WindowHandle, wm_gettext, txtlength, longint(@buffer[1]));
result := buffer;
end;
function GetURL: string;
var
ie, toolbar, combo,
comboboxex, edit,
worker, toolbarwindow: hwnd;
begin
ie := FindWindow(pchar("IEFrame"), nil);
worker := FindWindowEx(ie, 0, "WorkerA", nil);
toolbar := FindWindowEx(worker, 0, "rebarwindow32", nil);
comboboxex := FindWindowEx(toolbar, 0, "comboboxex32", nil);
combo := FindWindowEx(comboboxex, 0, "ComboBox", nil);
edit := FindWindowEx(combo, 0, "Edit", nil);
toolbarwindow := FindWindowEx(comboboxex, 0, "toolbarwindow32", nil);
result := GetText(edit);
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(GetURL);
end;
← →
Dextor © (2005-05-04 15:43) [4]СОРРИ, глюкануло
← →
balamutik © (2005-05-04 19:15) [5]спасибо большое
всем!!!
Страницы: 1 вся ветка
Форум: "WinAPI";
Текущий архив: 2005.06.29;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.059 c