🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by sa Sun, 15 Jun 2008 07:22
enum windows
#138
Author: sa
Date: Sun, 15 Jun 2008 07:22
38 lines
1855 bytes
Hi all
i am using code from previous posting to enumerate opened windows and 
minimize.


BOOL CALLBACK MinimizeAllWindows(HWND hwnd,LPARAM lParam)
{
    // determine if the window is owned by anyone
    HWND hParent = GetWindow(hwnd, GW_OWNER);

    // if the window is ownerless, and if it is visible,
    // then minimize it to the desktop
    if((hParent == NULL) && IsWindowVisible(hwnd))
    {

        ShowWindow(hwnd, SW_MINIMIZE);
    }

    // return true to continue the enumeration
    return TRUE;
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
// enumerate the desktop windows
    EnumWindows((WNDENUMPROC)MinimizeAllWindows, 0);
}

1.Before minimzing, i need to find the left and top position of the window. 
How can i find the positin of the window here.

    if((hParent == NULL) && IsWindowVisible(hwnd))
    {

        ShowWindow(hwnd, SW_MINIMIZE);
    }
Thanks
SA 
Re: enum windows
#140
Author: Ed Mulroy [TeamB]
Date: Sat, 14 Jun 2008 21:39
50 lines
2447 bytes
> ...i need to find the left and top position of the window.  How can i find 
> the positin of the window...

RECT r;

GetWindowRect(hwnd, &r);
// left is  r.left,  top is r.top

If the window is a client window then coordinates will be with respect to 
the parent.  In that case you can use MapWindowPoints to express them in 
screen coordinates.

.  Ed

> sa wrote in message
> news:48541a98@newsgroups.borland.com...
>
> i am using code from previous posting to enumerate opened windows and 
> minimize.
>
>
> BOOL CALLBACK MinimizeAllWindows(HWND hwnd,LPARAM lParam)
> {
>    // determine if the window is owned by anyone
>    HWND hParent = GetWindow(hwnd, GW_OWNER);
>
>    // if the window is ownerless, and if it is visible,
>    // then minimize it to the desktop
>    if((hParent == NULL) && IsWindowVisible(hwnd))
>    {
>        ShowWindow(hwnd, SW_MINIMIZE);
>    }
>
>    // return true to continue the enumeration
>    return TRUE;
> }
>
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> // enumerate the desktop windows
>    EnumWindows((WNDENUMPROC)MinimizeAllWindows, 0);
> }
>
> 1.Before minimzing, i need to find the left and top position of the 
> window.  How can i find the positin of the window here.
>
>    if((hParent == NULL) && IsWindowVisible(hwnd))
>    {
>        ShowWindow(hwnd, SW_MINIMIZE);
>    }
Re: enum windows
#141
Author: sa
Date: Mon, 16 Jun 2008 02:13
21 lines
1718 bytes
Thanks Ed for the answer.

It helps in minimizing te forms.

I am just extending from that to do something like this.

I have a APPBAR form. The height of the APPBAR is set to 30 pixels and set 
to top-most, to visible always, its working fine.

1.Lets say the position of the APPBAR form on the desktop is 
(0,0,Screen->Width,Screen->Height).
But some of the other applications may start from the 0,0 position of the 
screen. In such condition the other application forms go behind my APPBAR 
form and the title bar of those forms can't seen.
So i want to put a button on my form something like "Arrange Hidden Forms". 
that will move the other forms which are behind.

Thanks for the pointers.

Kind Regards
SA 
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