A way to remove a Dialog based app from the taskbar works, with a hitch 
Author Message
 A way to remove a Dialog based app from the taskbar works, with a hitch

Thanks to S. Brent Faulkner for forwording fragment to me....

static const TCHAR szTrayClass[] = _T("Shell_TrayWnd");
static const TCHAR szTaskClass[] = _T("MSTaskSwWClass");

void CHiddenDialog::RemoveFromTaskbar()
{
        ASSERT(::IsWindow(m_hWnd));

        // Get the taskbar's window handle
        HWND hwTray = ::FindWindowEx(NULL, NULL, szTrayClass, NULL);
        HWND hwTask = ::FindWindowEx(hwTray, NULL, szTaskClass, NULL);
        ASSERT( NULL != hwTask );

        // Get id of the shell's hook message
        UINT nMsg = ::RegisterWindowMessage( _T("SHELLHOOK") );
        ASSERT( NULL != nMsg );

        // Fake destruction of the window
        ::PostMessage(hwTask, nMsg, HSHELL_WINDOWDESTROYED, (LPARAM)m_hWnd);

Quote:
}

-----------------------------------
But, there is a hitch.....  About half of the time, when the windows
screensaver starts the dialog box is not hidden.  At this point I should
point out that this dialog box is a "always on top" window, which might
explain why it isn't being covered up, excpet that it was being covered up
before I inserted the above code into my app.

So, is there a way to tell that a screen saver has been activated, and
lower your window, or is there some other way to hide the app from the
taskbar?

Thanks for your help!



Wed, 25 Aug 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch



Quote:
>Thanks to S. Brent Faulkner for forwording fragment to me....
> [ undocumented stuff that doesn't work 100% of the time deleted ]

The rules for which windows get taskbar buttons are documented in
MSDN.  Look for the article titled "Visibility of taskbar
buttons".  The first paragraph includes the following curious
sentences:

        To prevent the window from being placed on the taskbar,
        create the window by calling CreateWindowEx and
        include the WS_EX_TOOLWINDOW style.
        As an alternative, you can create a hidden window
        and make it the owner of your primary window.

--
(My return address is intentionally invalid to foil spammers.  Delete the
".---" to get my real address.  I do this on my own time with my own money;
my responses are not to be considered official technical support or advice.)



Thu, 26 Aug 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch

Alan Robinson wrote ...

[snip]

Quote:
> So, is there a way to tell that a screen saver has been activated, and
> lower your window

[snip]

Alan,

For NT check out kb-article Q150785.

For Win95, use TOOLHELP32 and check for the extension .scr
for all running processes. If a process is found with this
extension it's a screen saver if it has a window that is
either top-most, full-screen, or has no parent.
See WDJ February 1997 for sample code.

Cheers,
Patrik

-----------------------------------------------------------------

AU-System Network AB



Fri, 03 Sep 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch

Raymond,

How can this work for a dialog?

--Brent



Quote:

> The rules for which windows get taskbar buttons are documented in
> MSDN.  Look for the article titled "Visibility of taskbar
> buttons".  The first paragraph includes the following curious
> sentences:

>    To prevent the window from being placed on the taskbar,
>    create the window by calling CreateWindowEx and
>    include the WS_EX_TOOLWINDOW style.
>    As an alternative, you can create a hidden window
>    and make it the owner of your primary window.



Sat, 04 Sep 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch



Quote:
> Raymond,

> How can this work for a dialog?

erm, becuase a dialog is a window?

Chris
--
======================================================================

     Chris Becke                        <http://www.dbn.lia.net/chris>
======================================================================



Sun, 05 Sep 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch

Since you don't use CreateWindowEx to create dialogs, the first
sentence doesn't help you.  But the second sentence does.  When
you create a dialog box, one of the parameters is hwndOwner.
Pass a handle to a hidden window.

On Tue, 18 Mar 1997 11:30:20 -0800, "S. Brent Faulkner"

Quote:

>Raymond,

>How can this work for a dialog?

>--Brent



>>        To prevent the window from being placed on the taskbar,
>>        create the window by calling CreateWindowEx and
>>        include the WS_EX_TOOLWINDOW style.
>>        As an alternative, you can create a hidden window
>>        and make it the owner of your primary window.

--
(My return address is intentionally invalid to foil spammers.  Delete the
".---" to get my real address.  I do this on my own time with my own money;
my responses are not to be considered official technical support or advice.)


Mon, 06 Sep 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch

Can we see the first few lines of your dialog template (in the .rc
file)?

You should add WS_EX_TOOLWINDOW to the EXSTYLE and make sure to remove
WS_EX_APPWINDOW.

HTH

Quote:



> > Since you don't use CreateWindowEx to create dialogs, the first
> > sentence doesn't help you.  But the second sentence does.  When
> > you create a dialog box, one of the parameters is hwndOwner.
> > Pass a handle to a hidden window.

> I've tried this but, the dialog still shows up in my taskbar. What am I
> missing?

-- Aaron

---------------------------------
Aaron J Margosis

Work phone:  703-873-2622 (703-USE-A-MAC ??!!)



Tue, 07 Sep 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch



Quote:
> Since you don't use CreateWindowEx to create dialogs, the first
> sentence doesn't help you.  But the second sentence does.  When
> you create a dialog box, one of the parameters is hwndOwner.
> Pass a handle to a hidden window.

I've tried this but, the dialog still shows up in my taskbar. What am I
missing?

--Brent



Tue, 07 Sep 1999 03:00:00 GMT  
 A way to remove a Dialog based app from the taskbar works, with a hitch

So that's the trick... I was missing the change to the dialog template.

THANKS!!!!!!

--Brent



Quote:
> Can we see the first few lines of your dialog template (in the .rc
> file)?

> You should add WS_EX_TOOLWINDOW to the EXSTYLE and make sure to remove
> WS_EX_APPWINDOW.

> HTH



Wed, 08 Sep 1999 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Showing taskbar visible dialog from dialog based app

2. Updating the Taskbar from a dialog based app

3. dialog based app in taskbar

4. Prevent taskbar entry for dialog-based app?

5. Remove app from taskbar

6. Resizing a dialog based app based on its view's size

7. Removing dialog/window button from taskbar

8. How to hide dialog based applinction on taskbar

9. Modeless dialog in a dialog-based app

10. dialog within dialog based apps

11. 2nd Dialog never appears in Dialog based app

12. Dialog-based app and modal dialog

 

 
Powered by phpBB® Forum Software