Article View: borland.public.cppbuilder.nativeapi
Article #14898Re: Need help with this code...(2)
From: micheal davis
Date: Tue, 29 Jul 2003 22:58
Date: Tue, 29 Jul 2003 22:58
91 lines
4496 bytes
4496 bytes
Thanks remy....I found my mistake...sorry for the misunderstanding...
Regards
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f26f381$1@newsgroups.borland.com...
>
> "micheal davis" <micheal_davis@hotmail.com> wrote in message
> news:3f26ec37@newsgroups.borland.com...
>
> > 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...
>
> You are still misunderstanding the entire procedure to accomplishing what
> you are asking for.
>
> > 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...
>
> There is no such pre-made function. You have to locate the URLs manually.
> I have already given you all of the code for doing that. The purpose of
> EnumWindows() is to loop through all of the currently active top-level
> windows on the desktop, whatever they happen to be. However, your
previous
> GetURL() function was only looking specific at the first active IE window
> every time it is called. There is no point in looping through all of the
> available windows at all if you are going to be looking at the same window
> each time. So I adjusted your GetURL() function so that it would grab the
> URL from a specific window that is passed to it instead of looking for
one.
> That way, the EnumWindows() code can loop through all of the active
windows,
> figure out which ones are IE windows, and then call GetURL() to get the
URL
> from each one.
>
> > my program will automatically add to my listbox all
> > the URLs in ALL active IE opened windows...
> > NOT a specific one....
>
> If you actually study the code I have given you, you will see that it does
> do exactly what you are asking for. It does look for *all* of the active
IE
> windows, and does retreive the URLs of *all* of the active IE windows. I
> think you need to read up more on how EnumWindows() works in general, it
> seems to me that you are under the impression that the callback function
> will only be called for a single window, which in fact it will be called
> once for each active top-level window instead.
>
> > 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...
>
> It works fine when I try it. However, there was a small typo in my
previous
> example. Change this line:
>
> ((TListBox*)lParam)->Items->Add(GetURL(hwnd));
>
> To this instead:
>
> ((TStrings*)lParam)->Add(GetURL(hwnd));
>
> Also, just as a side note, when calling EnumWindows(), you sould call the
> ListBox's BeginUpdate() and EndUpdate() methods as well:
>
> void __fastcall TForm1::GetWindowsInfo()
> {
> UrlListBox->Items->Clear();
> UrlListBox->Items->BeginUpdate();
> try
> {
> if( !EnumWindows((WNDENUMPROC)MyWindowsProc,
> (LPARAM)UrlListBox->Items) )
> ShowMessage("Error occured while EnumWindows");
> }
> __finally {
> UrlListBox->Items->EndUpdate();
> }
> }
>
>
> Gambit
>
>
Technical Details
Message-ID:
<3f26fc1d@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!news.maxwell.syr.edu!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f268dd9@newsgroups.borland.com> <3f26be21@newsgroups.borland.com> <3f26c2cc@newsgroups.borland.com> <3f26d436$1@newsgroups.borland.com> <3f26ec37@newsgroups.borland.com> <3f26f381$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 16:10:17 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> <3f26ec37@newsgroups.borland.com> <3f26f381$1@newsgroups.borland.com> Subject: Re: Need help with this code...(2) Date: Tue, 29 Jul 2003 14:58:23 -0800 Lines: 93 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: <3f26fc1d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1059519517 62.135.6.245 (29 Jul 2003 15:58:37 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail