🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: F5 Refresh Explorer

#16687
From: StarCinema - Rodolfo Frino
Date: Tue, 29 Apr 2003 15:48
38 lines
2033 bytes
If you want to send a windows message to all instances of an application
(for example the WM_CLOSE message)
you can use this callback function

BOOL CALLBACK CloseAllWindowsByClassName(HWND Handle, LPARAM lParam)
{
    char WindowClassName[256] = {0};

    if (GetClassName(Handle, WindowClassName, 255))
        if (stricmp(WindowClassName, (char*)lParam) == 0)
            PostMessage(Handle, WM_CLOSE, 0, 0);

    return TRUE;
}



void __fastcall TForm1::Button1Click(TObject *Sender)
{
    // Select your Application
    //String WindowClassName = "Notepad";
    //String WindowClassName = "IEFrame";
    String WindowClassName   = "ExploreWClass";

    EnumWindows((WNDENUMPROC)CloseAllWindowsByClassName,
(LPARAM)WindowClassName.c_str());
}

Rodolfo
Stargate Software


> This will fail when more one one session of Internet Explorer is
> running, I think. Haven't tested it.
>
> Ron Sommer
>
>
Technical Details
Message-ID: <3eae9f9f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!out.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3eadfe5c@newsgroups.borland.com> <3eae1e5a@newsgroups.borland.com> <3EAE592D.3080509@telekom.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2a8b24ef7e4ae381
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-29 09:03:06 PST
From: "StarCinema - Rodolfo Frino" <starcinema@stargate.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3eadfe5c@newsgroups.borland.com> <3eae1e5a@newsgroups.borland.com> <3EAE592D.3080509@telekom.de>
Subject: Re: F5 Refresh Explorer
Date: Wed, 30 Apr 2003 01:48:06 +1000
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 203.164.37.191
Message-ID: <3eae9f9f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1051631519 203.164.37.191 (29 Apr 2003 08:51:59 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!out.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail