🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14895

Re: Need help with this code...(2)

#14895
From: micheal davis
Date: Tue, 29 Jul 2003 21:50
113 lines
4505 bytes
Hi remy..

thank you so much for your reply....I think I didn't understand you
well...when you said I must tell GetURL function which window it must look
to each time...if this is what you meant then I believe there is
misunderstanding...when I tried to use EnumWindows function... I was looking
for API function that I can use to search for all active IE open windows and
with the GetURL code...my program will automatically add to my listbox all
the URLs in ALL active IE opened windows...NOT a specific one....

Anyway I copied your code as is and I tried to run it by calling and
unfortunately it didn't retrieve any URL's from the active IE opened
windows...

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    GetWindowsInfo();
}
//--------------------------------------------------------------------------
-


instead to make it work I've to make

void __fastcall TForm1::Button1Click(TObject *Sender)
{

    HWND ie;
    ie=FindWindow("IEFrame",NULL);
   GetURL(ie);
}
//--------------------------------------------------------------------------
-

and that is NOT what I was looking for from EnumWindows Function

Once again thank you so much for your patience and support

Regards



"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f26d436$1@newsgroups.borland.com...
>
> "micheal davis" <micheal_davis@hotmail.com> wrote in message
> news:3f26c2cc@newsgroups.borland.com...
>
> > BOOL CALLBACK MyWindowsProc( HWND hwnd, LPARAM lParam )
> > {
> >    Form1->GetURL();
> >
> >    BOOL ret = TRUE;
> >    return ret;
> > }
>
> Even though you are enumerating windows, you are still only looking at the
> active IE window when retreiving the actual URL.  That is why you are
seeing
> the same URL repeated over and over.  You need to tell GetURL() which
actual
> window to look at each time.
>
> Try this instead:
>
>     AnsiString __fastcall GetText(HWND WindowHandle)
>     {
>         int txtLength;
>         AnsiString buffer;
>
>         txtLength = ::SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0) +
1;
>         buffer.SetLength(txtLength);
>         ::SendMessage(WindowHandle, WM_GETTEXT, txtLength,
> (LPARAM)buffer.c_str());
>
>         return buffer;
>     }
>
>     AnsiString __fastcall GetURL(HWND IEWindowHandle)
>     {
>         HWND worker, toolbar, comboboxex, combo, edit;
>
>         worker = ::FindWindowEx(IEWindowHandle, 0, "WorkerA", NULL);
>         toolbar = ::FindWindowEx(worker, 0, "ReBarWindow32", NULL);
>         comboboxex = ::FindWindowEx(toolbar, 0, "ComboBoxEx32", NULL);
>         combo = ::FindWindowEx(comboboxex, 0, "ComboBox", NULL);
>         edit = ::FindWindowEx(combo, 0, "Edit", NULL);
>
>         return GetText(edit);
>     }
>
>     BOOL CALLBACK MyWindowsProc( HWND hwnd, LPARAM lParam )
>     {
>         char buffer[12] = {0};
>         ::GetClassName(hwnd, buffer, 12);
>         if( StrComp(buffer, "IEFrame") == 0 )
>             ((TListBox*)lParam)->Items->Add(GetURL(hwnd));
>         return TRUE;
>     }
>
>     void __fastcall TForm1::GetWindowsInfo()
>     {
>         UrlListBox->Items->Clear();
>         if( !EnumWindows((WNDENUMPROC)MyWindowsProc,
> (LPARAM)UrlListBox->Items) )
>             ShowMessage("Error occured while EnumWindows");
>     }
>
>
> Gambit
>
>
Technical Details
Message-ID: <3f26ec37@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f268dd9@newsgroups.borland.com> <3f26be21@newsgroups.borland.com> <3f26c2cc@newsgroups.borland.com> <3f26d436$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,58a7894f639848fb
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-29 15:10:27 PST
From: "micheal davis" <micheal_davis@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f268dd9@newsgroups.borland.com> <3f26be21@newsgroups.borland.com> <3f26c2cc@newsgroups.borland.com> <3f26d436$1@newsgroups.borland.com>
Subject: Re: Need help with this code...(2)
Date: Tue, 29 Jul 2003 13:50:35 -0800
Lines: 115
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 62.135.6.245
Message-ID: <3f26ec37@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1059515447 62.135.6.245 (29 Jul 2003 14:50:47 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail