Board index » cppbuilder » Re: enum windows

Re: enum windows


2008-06-15 05:39:55 AM
cppbuilder113
Quote
...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
Quote
sa wrote in message
news: XXXX@XXXXX.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:Re: enum windows

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:Re: enum windows

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
 

{smallsort}