🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Opening up Web Browsers inside my App

#7150
From: Hans Galema
Date: Tue, 08 Mar 2005 08:52
41 lines
2109 bytes
Gav wrote:

> Works fine, but only if I know the exact title text of the window.
> Being web pages that open up in IE, Opera, Netscape, Mozilla etc
> then I think I am going to have difficulty knowing the title text as it
> is set by the web designer and could be anything.

There is GetClassName() too.

> Thanks for your help, this is the furthest I have got in a long time
> and feel there is not much more to go now to get this right.

Please let you inspire by following code:
You only need a TMemo and a TButon on a TForm.
Code lists all the running processes.

void __fastcall TForm1::Button3Click(TObject *Sender)
{
  Memo1->Clear();

  HWND hwnddesktop = GetDesktopWindow();
  HWND hwnd = FindWindowEx(hwnddesktop, 0, 0, 0);

  while( hwnd )
   {
    count++;

    char buffer[250];

    GetWindowText(hwnd, buffer, sizeof(buffer));

    if( ! buffer [0] )
       GetClassName(wnd, buffer, sizeof(buffer));

    Memo1->Lines->Add( buffer );

    hwnd = FindWindowEx(hwnddesktop, hwnd, 0, 0);
   }
}

Hans.
Technical Details
Message-ID: <422d6840$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <422926aa$1@newsgroups.borland.com> <422c31bd$1@newsgroups.borland.com> <422c515c@newsgroups.borland.com> <422c7e08$1@newsgroups.borland.com> <422ce3f2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,91b603800ded4d32
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 08 Mar 2005 09:52:38 +0100
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Opening up Web Browsers inside my App
References: <422926aa$1@newsgroups.borland.com> <422c31bd$1@newsgroups.borland.com> <422c515c@newsgroups.borland.com> <422c7e08$1@newsgroups.borland.com> <422ce3f2$1@newsgroups.borland.com>
In-Reply-To: <422ce3f2$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 129.125.201.248
Message-ID: <422d6840$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1110272064 129.125.201.248 (8 Mar 2005 00:54:24 -0800)
Lines: 41
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail