Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Prevenet to minimize a window in Show Desktop

80 views
Skip to first unread message

Javier Martínez

unread,
Oct 23, 2003, 4:55:18 PM10/23/03
to
Hi
is it possible to a window prevent to miminize when the user click the icon
Show Desktop?
Thnak you in advance

Rhett Gong

unread,
Oct 24, 2003, 4:51:30 AM10/24/03
to
Hi Javier:
Can you tell me in which situation you want to prevent the icon Show
Desktop minimizing the window when the user click?

Best regards,

Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.

Raymond Chen

unread,
Oct 24, 2003, 10:48:49 PM10/24/03
to
But the user said "Show desktop, hide all my other programs". You should
follow the user's instructions and let yourself be hidden. Programs
shouldn't disobey the user.

"Javier Martínez" <ja...@tid.es> wrote in message
news:uvbgsPhm...@TK2MSFTNGP10.phx.gbl...
> Hi
>
> I have a small window (see the capture) that always may be visible,
because
> if the user click the windows, this window expand a big size. If the user
> click the icon Show Desktop my small window disappear. I don't want this
> behaviour.
>
>
>
> To put the style WS_EX_TOPMOST is not adequate because I want that other
> windows overlapped over my small window.
>
>
>
> I try a hook CBT to catch HCBT_MINMAX and return true, but doesn't work
> because the window is not visible after the user push ShowDesktop.
>
> Can you help me?
>
>
>
> Javier
>
>
>
> "Rhett Gong" <v-ra...@online.microsoft.com> escribió en el mensaje
> news:bcLPKwgm...@cpmsftngxa06.phx.gbl...

Rhett Gong

unread,
Oct 26, 2003, 10:05:46 PM10/26/03
to
Hi Javier:
I think you can use WS_EX_TOPMOST and WS_EX_TOOLWINDOW to achieve your
goal!

Jim Barry

unread,
Oct 27, 2003, 8:42:29 AM10/27/03
to
Rhett Gong wrote:
> I think you can use WS_EX_TOPMOST and WS_EX_TOOLWINDOW
> to achieve your goal!

Javier already said that WS_EX_TOPMOST was no good. I agree with Raymond though, the desired behaviour would probably be, er, undesirable. However, creating the window as a child of the desktop folder window might do the trick. The window hierarchy can be determinied with Spy++, but obviously this is an implementation detail of Explorer and should not be relied upon!

--
Jim Barry, MVP for Windows SDK
"For bureaucratic reasons, we settled on one issue, weapons of mass
destruction, because it was the one reason everyone could agree on."
Paul Wolfowitz, US Deputy Defence Secretary

Rhett Gong

unread,
Oct 28, 2003, 12:45:55 AM10/28/03
to
Hi Javier:
Also,you can create the window without the WS_MINIMIZE window style, and
handle the WM_GETMINMAXINFO and/or WM_WINDOWPOSCHANGING.
-

Javier Martínez

unread,
Oct 28, 2003, 4:33:50 AM10/28/03
to
I have tested that when the user click "ShowDesktop" the window never
receive WM_GETMINMAXINFO or WM_WINDOWPOSCHANGING to minimize, yes to
restore but is not enough

"Rhett Gong" <v-ra...@online.microsoft.com> escribió en el mensaje
news:Wuy4DbR...@cpmsftngxa06.phx.gbl...

Javier Martínez

unread,
Oct 28, 2003, 4:35:30 AM10/28/03
to
I tested it thar to make the window WS_CHILS is not enough
"Jim Barry" <j...@mvps.org> escribió en el mensaje
news:e2v6v$InDHA...@TK2MSFTNGP09.phx.gbl...

Rhett Gong

unread,
Oct 28, 2003, 9:44:37 PM10/28/03
to
Hi Javier:
Not enough?
Can you describe your request with more detailed information? Let me see
if I can help you more! ;-)

Javier Martínez

unread,
Oct 29, 2003, 3:02:20 AM10/29/03
to
Betterthat ' not enough'is doesn't work.
My small window, no receice the message WM_POSCHANGING when the user click
show desktop.
What is the behavior of show desktop excactly? How can be that my window is
minimzed and the window not receive any messge?

"Rhett Gong" <v-ra...@online.microsoft.com> escribió en el mensaje

news:EPvqfac...@cpmsftngxa06.phx.gbl...

Rhett Gong

unread,
Oct 29, 2003, 5:34:41 AM10/29/03
to
Hi Javier:
You can handle WM_POSCHANGING in this way:
void CTopMostDlg::OnWindowPosChanging(WINDOWPOS* lpwndpos)
{
SetWindowPos(&wndTopMost,lpwndpos->x,lpwndpos->y,lpwndpos->cx,lpwndpos->cy,
SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
}

Does this answer your question?
If it does, please let me know! I will feel happier for that.
If not, write your problems with detailed information. I always do my best
to solve your problems;-)

Javier Martínez

unread,
Oct 29, 2003, 8:21:43 AM10/29/03
to
Hi
Sorry, but this code isn't the response, because when the user click the
icon ShowDesktop, my window NOT receive WM_POSCHANGING and then these code
is not runned.

My problems are:
The user click the icon ShowDesktop and the application is minimized or
similar, and I can`t find out the way to prevent this behavior.


"Rhett Gong" <v-ra...@online.microsoft.com> escribió en el mensaje

news:psvyJhgn...@cpmsftngxa06.phx.gbl...

Jim Barry

unread,
Oct 29, 2003, 10:05:11 AM10/29/03
to
Javier Martínez wrote:
> I tested it thar to make the window WS_CHILS is not enough

How do you mean? It seemed to work well enough when I tried it.

- Jim

Javier Martínez

unread,
Oct 29, 2003, 10:11:21 AM10/29/03
to
I put to my window the sytle WS_CHILD:

VERIFY(m_pWnd->CreateEx( WS_EX_TOOLWINDOW,
AfxRegisterWndClass(CS_DBLCLKS,::LoadCursor(NULL,
IDC_ARROW),(HBRUSH) ::GetStockObject(WHITE_BRUSH),NULL),
_T("TMTab"),
WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,
CRect(0,0,100,100),
CWnd::GetDesktopWindow(),
NULL));

And when the user clicks the icon "Show Desktop" the window is minimized

"Jim Barry" <j...@mvps.org> escribió en el mensaje

news:e23KW3in...@TK2MSFTNGP11.phx.gbl...

Jim Barry

unread,
Oct 29, 2003, 10:36:52 AM10/29/03
to
Javier Martínez wrote:
> VERIFY(m_pWnd->CreateEx( WS_EX_TOOLWINDOW,
> AfxRegisterWndClass(CS_DBLCLKS,::LoadCursor(NULL,
> IDC_ARROW),(HBRUSH) ::GetStockObject(WHITE_BRUSH),NULL),
> _T("TMTab"),
> WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,
> CRect(0,0,100,100),
> CWnd::GetDesktopWindow(),
> NULL));

I meant to make it a child of the desktop's folder view, not the desktop window itself. Check it with Spy++, it should be like this:

"" #32769 (Desktop)
"Program Manager" Progman
"" SHELLDLL_DefView
"FolderView" SysListView32

- Jim

Javier Martínez

unread,
Oct 29, 2003, 4:17:41 PM10/29/03
to
Thanks, this code works fine

"Jim Barry" <j...@mvps.org> escribió en el mensaje

news:eup9CJjn...@TK2MSFTNGP10.phx.gbl...

Raymond Chen

unread,
Oct 31, 2003, 2:01:52 AM10/31/03
to
When the user clicks Show Desktop, all windows that can be minimized are
minimized. The desktop window then makes itself topmost so it covers the
windows that cannot be minimized. So you do not receive a
WM_WINDOWPOSCHANGING message because your window position isn't changing.
You've merely been covered by another window (the desktop window). When the
user lowers the desktop, your window will return (again, not because it was
moved, but because the desktop window has moved out of the way).

"Javier Martínez" <ja...@tid.es> wrote in message

news:%23DF%23d%23hnDH...@tk2msftngp13.phx.gbl...

Raymond Chen

unread,
Oct 31, 2003, 2:03:15 AM10/31/03
to
Please don't do this. Windows that attach themselves to the desktop create
all sorts of stability problems and compatibility nightmares. (For example,
suppose Explorer decides to destroy the desktop and recreate it. When a
window is destroyed, all its child windows are destroyed, so POOF your
window just got destroyed.)

"Javier Martínez" <ja...@tid.es> wrote in message

news:%23C5faIm...@TK2MSFTNGP11.phx.gbl...

0 new messages