🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
13 messages
13 total messages Started by RaynorPao Tue, 29 Apr 2003 04:40
F5 Refresh Explorer
#16772
Author: RaynorPao
Date: Tue, 29 Apr 2003 04:40
7 lines
1000 bytes
Hi all:

I can press key "F5" to refresh Explorer.
How can I do this programmatically?

Thanks.
RaynorPao.
Re: F5 Refresh Explorer
#16774
Author: StarCinema - Rodolfo Frino
Date: Tue, 29 Apr 2003 06:36
26 lines
1524 bytes
    HWND Handle = FindWindow("ApplicationClass", NULL);
    if(Handle)
    {
        BringWindowToTop(Handle);            // Bring Application to Top
        keybd_event(VK_F5, 0, 0, 0);
// Down
        keybd_event(VK_F5, 0, KEYEVENTF_KEYUP, 0);    // Up
    }
    else
    {
        ShowMessage("Invalid Handle. Application might not be open");
    }

Rodolfo

"RaynorPao" <RaynorPao.nospam@nospam.pchome.com.tw> wrote in message
news:3eadfe5c@newsgroups.borland.com...
> Hi all:
>
> I can press key "F5" to refresh Explorer.
> How can I do this programmatically?
>
> Thanks.
> RaynorPao.
>
>
Re: F5 Refresh Explorer
#16775
Author: StarCinema - Rodolfo Frino
Date: Tue, 29 Apr 2003 06:40
5 lines
1044 bytes
For internet Explorer the Class will be "IEFrame"

HWND Handle = FindWindow("IEFrame", NULL);

Rodolfo
Re: F5 Refresh Explorer
#16776
Author: RaynorPao
Date: Tue, 29 Apr 2003 08:08
18 lines
1328 bytes
Hi Rodolfo:

Thanks for your reply.
But, I don't know how to get the HWND of Explorer.
Is there an API can do this?

Thanks.
RaynorPao.

"StarCinema - Rodolfo Frino" <starcinema@stargate.com> ���g��l��
news:3eae1f36@newsgroups.borland.com...
> For internet Explorer the Class will be "IEFrame"
>
> HWND Handle = FindWindow("IEFrame", NULL);
>
> Rodolfo
>
>
Re: F5 Refresh Explorer
#16777
Author: StarCinema - Rodolfo Frino
Date: Tue, 29 Apr 2003 08:23
36 lines
1858 bytes
You use the FindWindow() API to get the handle of
an application.

HWND Handle = FindWindow(WindowClass, NULL);

In this case the application is Internet Explorer,
whose WindowClass is "IEFrame", therefore
you get the handle of Explorer with this line:

HWND Handle = FindWindow("IEFrame", NULL);

Rodolfo


"RaynorPao" <RaynorPao.nospam@nospam.pchome.com.tw> wrote in message
news:3eae2f1e@newsgroups.borland.com...
> Hi Rodolfo:
>
> Thanks for your reply.
> But, I don't know how to get the HWND of Explorer.
> Is there an API can do this?
>
> Thanks.
> RaynorPao.
>
> "StarCinema - Rodolfo Frino" <starcinema@stargate.com> ���g��l��
> news:3eae1f36@newsgroups.borland.com...
> > For internet Explorer the Class will be "IEFrame"
> >
> > HWND Handle = FindWindow("IEFrame", NULL);
> >
> > Rodolfo
> >
> >
>
>
Re: F5 Refresh Explorer
#16778
Author: RaynorPao
Date: Tue, 29 Apr 2003 09:21
24 lines
1808 bytes
Hi Rodolfo:

Thanks for your reply.
But, I don't want to get the HWND of Internet Explorer(Web Browser).
I just want to get the HWND of Explorer(File System).
Would you please tell me how to get the HWND of Explorer?

Thanks.
RaynorPao.

"StarCinema - Rodolfo Frino" <starcinema@stargate.com> ���g��l��
news:3eae3762@newsgroups.borland.com...
> You use the FindWindow() API to get the handle of
> an application.
>
> HWND Handle = FindWindow(WindowClass, NULL);
>
> In this case the application is Internet Explorer,
> whose WindowClass is "IEFrame", therefore
> you get the handle of Explorer with this line:
>
> HWND Handle = FindWindow("IEFrame", NULL);
>
> Rodolfo
R: F5 Refresh Explorer
#16779
Author: Steve
Date: Tue, 29 Apr 2003 09:48
5 lines
1300 bytes
> I just want to get the HWND of Explorer(File System).

Perhaps "ExploreWClass" (not tested).

Steve.
Re: F5 Refresh Explorer
#16681
Author: Ron Sommer
Date: Tue, 29 Apr 2003 10:51
19 lines
1582 bytes
>     HWND Handle = FindWindow("ApplicationClass", NULL);
>     if(Handle)
>     {
>         BringWindowToTop(Handle);            // Bring Application to Top
>         keybd_event(VK_F5, 0, 0, 0);
> // Down
>         keybd_event(VK_F5, 0, KEYEVENTF_KEYUP, 0);    // Up
>     }
>     else
>     {
>         ShowMessage("Invalid Handle. Application might not be open");
>     }



This will fail when more one one session of Internet Explorer is 
running, I think. Haven't tested it.

Ron Sommer
Re: F5 Refresh Explorer
#16684
Author: StarCinema - Rodolfo Frino
Date: Tue, 29 Apr 2003 12:51
12 lines
1358 bytes
> This will fail when more one one session of Internet Explorer is
> running, I think. Haven't tested it.
>
> Ron Sommer


No, it won't fail. It will act on the topmost "ClassName" ("IEFrame" in this
case) window

Rodolfo
Stargate
http://members.optusnet.com.au/~rodolfofrino/
Re: F5 Refresh Explorer
#16683
Author: StarCinema - Rodolfo Frino
Date: Tue, 29 Apr 2003 13:00
20 lines
1816 bytes
Sorry RaynorPao, I thought you were referring to Internet Explorer
If you want to refresh the Windows Explorer then you have to use
the "ExploreWClass" Window Class, and the call is:

   HWND Handle = FindWindow("ExploreWClass", NULL);

If you have more than one Windows Explorer instances running, the code will
affect the topmost
"ExploreWClass" Window (the one with the highest Z order)

Regards
Rodolfo

> Thanks for your reply.
> But, I don't want to get the HWND of Internet Explorer(Web Browser).
> I just want to get the HWND of Explorer(File System).
> Would you please tell me how to get the HWND of Explorer?
>
> Thanks.
> RaynorPao.
Re: F5 Refresh Explorer
#16686
Author: RaynorPao
Date: Tue, 29 Apr 2003 14:57
15 lines
1399 bytes
Hi Steve:

Yes!! You are right!!
Thank you very much.
RaynorPao.

"Steve" <steve_alettoANTI@SPAMhotmail.com> ���g��l��
news:3eae4a95@newsgroups.borland.com...
> > I just want to get the HWND of Explorer(File System).
>
> Perhaps "ExploreWClass" (not tested).
>
> Steve.
>
>
Re: F5 Refresh Explorer
#16685
Author: RaynorPao
Date: Tue, 29 Apr 2003 14:58
22 lines
1744 bytes
Hi Rodolfo:

^_^...It's OK!!

Thank you very much.
RaynorPao.

"StarCinema - Rodolfo Frino" <starcinema@stargate.com> ���g��l��
news:3eae784a@newsgroups.borland.com...
> Sorry RaynorPao, I thought you were referring to Internet Explorer
> If you want to refresh the Windows Explorer then you have to use
> the "ExploreWClass" Window Class, and the call is:
>
>    HWND Handle = FindWindow("ExploreWClass", NULL);
>
> If you have more than one Windows Explorer instances running, the code
will
> affect the topmost
> "ExploreWClass" Window (the one with the highest Z order)
>
> Regards
> Rodolfo
Re: F5 Refresh Explorer
#16687
Author: 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
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads