Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Получение текста из адресной строки explorera


balamutik ©   (2005-05-04 14:13:00) 

Помогите кто-нить с этой проблемой.
Спасибо заранее!!!


balamutik   (2005-05-04 19:15:00) [1]

спасибо большое
всем!!!


Dextor   (2005-05-04 15:43:00) [2]

СОРРИ, глюкануло


Dextor   (2005-05-04 15:42:00) [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:41:00) [4]

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;


easy   (2005-05-04 15:18:00) [5]

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;


Наверх

Титульная страница Поиск, карта сайта Написать письмо