Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 8 odgovora
  • 2.923 pregleda

Najnovija ↓

EnumerateWindows problem 21.09.2010. u 17:17 · pre 196 meseci #1
pozdrav!naleteo sam na jedan clanak na http://delphi.about.com/od/windowsshellapi/l/aa060303b.htm o tome kako dobiti text iz ie edit polja za adrese..i naravno hteo sam da ga pokrenem medjutim stalno mi javlja gresku 'Variable required',pa ako bi neko mogao da mi kaze u cemu je stvar..

...
function GetUrlFromIE (Handle: THandle; List: TStringList): boolean; stdcall;
...
procedure TForm1.btnRefreshClick(Sender: TObject);
begin
lbIEURL.Clear;
EnumWindows(@GetUrlFromIE, LParam(lbIEURL.Items)); <---GRESKA
end;

function GetUrlFromIE (Handle: THandle; List: TStringList):
boolean; stdcall;
var
hWndIE, hWndIEChild : HWND;
Buffer : array[0..255] of Char;
begin
//get the window caption
SendMessage(Handle, WM_GETTEXT, 255, integer(@Buffer[0]));
//look for the Internet Explorer window with "Buffer" caption
hWndIE := FindWindow('IEFrame', Buffer);
if hWndIE > 0 then
begin
//try to get a handle to IE's toolbar container
hWndIEChild := FindWindowEx(hWndIE, 0, 'WorkerW', nil);
if hWndIEChild > 0 then
begin
//get a handle to address bar
hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
if hWndIEChild > 0 then
begin
//finally, locate combo box and add its text to the list
hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil);
if hWndIEChild > 0 then
begin
SendMessage(hWndIEChild, WM_GETTEXT, 255, integer(@Buffer));
//List.AddObject(Buffer,TObject(hWndIE));
List.Add(Buffer)
end;
end;
end;
end;
//continue enumeration
Result :=True;
end; (*GetUrlFromIE*)
Re: EnumerateWindows problem 21.09.2010. u 20:27 · pre 196 meseci #2
> kako dobiti text iz ie edit polja za adrese..i naravno hteo sam da ga pokrenem medjutim stalno mi javlja gresku 'Variable required',pa ako
> bi neko mogao da mi kaze u cemu je stvar..

Verovatno drugačija deklaracija funkcije u odnosu na verziju kada je pisan kod. Napiši gde ti tačno javlja grešku i koji delphi koristiš.
Pokušaj i da kod pišeš između code tagova, mnogo je preglednije.
Potpis
Do not be a help vampire (http://slash7.com/pages/vampires), use the google.

How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html
http://solair.eunet.rs/~fangor...stions/smart-questions.sr.html
Re: EnumerateWindows problem 21.09.2010. u 20:58 · pre 196 meseci #3
koristim delphi 7..stavio sam strelicu gde je greska,kod "EnumWindows(@GetUrlFromIE, LParam(lbIEURL.Items));"
hvala!
Re: EnumerateWindows problem 22.09.2010. u 00:37 · pre 196 meseci #4
Code:

procedure TForm1.btnRefreshClick(Sender: TObject);
var
  s: TStringList;
begin
  s := TStringList.Create();
  s.Clear;
  EnumWindows(@GetUrlFromIE, LParam(s));
  lbIEURL.Clear;
  lbIEURL.Items.AddStrings(s);
  s.Free;
end;
Re: EnumerateWindows problem 22.09.2010. u 12:36 · pre 196 meseci #6
> ne vredi,opet prijavljuje istu gresku.. :/

Koja kontrola ti je lbIEURL?

Da nisi negde redeklarisao EnumWindows? Pošalji jedan test projekat.
Potpis
Do not be a help vampire (http://slash7.com/pages/vampires), use the google.

How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html
http://solair.eunet.rs/~fangor...stions/smart-questions.sr.html
Re: EnumerateWindows problem 22.09.2010. u 17:43 · pre 196 meseci #8
1) GetUrlFromIE mora biti obična funkcija ne metoda, dakle izbaci deklaraciju iz forme.
2) Svaka funkcija (pa i GetUrlFromIE) mora biti deklarisana pre nego što se može pozvati, dakle, njena definicija mora doći pre pozivanja u TForm1.Button1Click.
Potpis
Do not be a help vampire (http://slash7.com/pages/vampires), use the google.

How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html
http://solair.eunet.rs/~fangor...stions/smart-questions.sr.html
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme