Hello,

I created a simple window.
When the user press Done, in the handler in WndProc I put an
notification icon on the try then I call:

ShowWindow(hWnd,SW_HIDE);
UpdateWindow(hWnd);

Thw window is gone as expected. Cool !!!

When the icon is clicked, in the message handler and I call the
sequence:
ShowWindow(hWnd,SW_SHOW);
UpdateWindow(hWnd);
BringWindowToTop(hWnd);

Surprize, the window is still hidden. The message is received and this
sequence it is executed, I stepped thru it from debuger. Yet, the window
is still shy to show it face.

Any idea why this may happen ?

I am supposed to do smtg. else to hide/show a window ?

TIA.

Re: SW_SHOW/SW_HIDE by r_z_aret

r_z_aret
Fri Jan 19 14:12:33 CST 2007

On Thu, 18 Jan 2007 16:27:59 -0500, DragonSt0rm
<RemoveDragonmtm_spm@yahoo.com> wrote:

>Hello,
>
>I created a simple window.
>When the user press Done, in the handler in WndProc I put an
>notification icon on the try then I call:
>
> ShowWindow(hWnd,SW_HIDE);
> UpdateWindow(hWnd);
>
>Thw window is gone as expected. Cool !!!
>
>When the icon is clicked, in the message handler and I call the
>sequence:
> ShowWindow(hWnd,SW_SHOW);
> UpdateWindow(hWnd);
> BringWindowToTop(hWnd);

I use
ShowWindow( hWnd, SW_SHOWNORMAL );
SetForegroundWindow( hWnd );

>
>Surprize, the window is still hidden. The message is received and this
>sequence it is executed, I stepped thru it from debuger. Yet, the window
>is still shy to show it face.
>
>Any idea why this may happen ?

I don't really know, but can speculate:

1) your app was minimized, so simply showing isn't enough

2) BringWindowToTop is disabled, or has some other function
Microsoft definitely changed behavior of related functions in at least
some versions of Windows, to prevent abuse, but I don't remember
details.

>
>I am supposed to do smtg. else to hide/show a window ?
>
>TIA.
>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com