Article View: borland.public.cppbuilder.nativeapi
Article #7418Re: detect minimzed windows
From: nicolasr
Date: Sat, 05 Feb 2005 00:38
Date: Sat, 05 Feb 2005 00:38
73 lines
3081 bytes
3081 bytes
thanks for the quick reply!
>> Notepad and MSPaint, f.e., minimize to a small rectangle
>> (with system menu) placed at the lower end of the work area.
>
> There is no taskbar available on the new Desktop, so minimized apps have
> nowhere else to go.
>
Yes and that would actually be enough for my current application.
But since all minimized IE windows disappear I can't do it this way :-(
>> I checked with EnumWindows that it's actually still there,
>> minimized and visible, but GetWindowRect tells me that
>> its position is -32000, -32000.
>
> Checking the coodinates of a minimized window is not meaningful since the
> window is not visible to begin with. Use IsIconic() to determine if a
> window is minimized or not.
>
> Are you calling GetWindowRect() while the window is not minimized? Where
> exactly are you calling it from? Is it being called from a thread that is
> associated with the new Desktop?
>
Here is part of my test code. I have a few buttons on my
custom shell window. One of them calls EnumWindows
with the EnumWindowsProc below. The minimized windows
are always found visible and iconized.
When I do this for a minimized Notepad I get a top coordinate of
737, which seems to be correct on a 1024/768 resolution.
IE windows, as I said, seem to be lost. The test code below restores
them however!!
bool IsVisible(HWND hwnd)
{
RECT rc;
GetWindowRect(hwnd, &rc);
if(IsWindowVisible(hwnd) && (rc.right-rc.left) > 0
&& (rc.bottom-rc.top) > 0)
return true;
else
return false;
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
if(IsVisible(hwnd))
{
if(IsIconic(hwnd))
{
char buffer[256];
GetClassName(hwnd, buffer, 255);
ShowMessage(AnsiString("Found: ") + buffer);
RECT rc = {0};
GetWindowRect(hwnd, &rc);
ShowMessage(rc.top);
//restore minimized windows
ShowWindow(hwnd, SW_RESTORE);
}
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
return TRUE;
}
Technical Details
Message-ID:
<4204158e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<42013951$1@newsgroups.borland.com> <4204056f$1@newsgroups.borland.com> <42040c57$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ee771e81de1fa4e1 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "nicolasr" <nicolasrNOSPAMATSIGNgmx.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <42013951$1@newsgroups.borland.com> <4204056f$1@newsgroups.borland.com> <42040c57$1@newsgroups.borland.com> Subject: Re: detect minimzed windows Date: Sat, 5 Feb 2005 01:38:35 +0100 Lines: 75 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 80.133.178.39 Message-ID: <4204158e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1107563918 80.133.178.39 (4 Feb 2005 16:38:38 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news1.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail