|
Hello together,
I really appreciate the article and have used the described procedure some years ago, to write my own taskbar, hiding specific windows from the standard windows taskbar and managing them in my own taskbar. I never had any problems until I changed to Windows 10.
Before Windows 10 (e.g. Windows 7) using:
ITaskbarList.DeleteTab(IntPtr) caused the Icon in the taskbar to disappear, but when you pressed ALT+TAB, it was still visible and thus accessible, when toggeling through the windows.
In Windows 10, the icon disappears in the taskbar (so far so good) but : it is not visible to Alt+TAB and thus inaccessible.
Does anyone have an Idea on how to bring them back to the ALT+TAB dialog?
|
|
|
|
|
When I am trying to use this object, I encounter an error:
error C2065: 'LPITaskbarList' : undeclared identifier
of course, I put the header:
#include "Shobjidl.h"
for nothing ... same error ... can you help me ? I have tried in an VS2008 test project, under Windows 10, 64 bit.
|
|
|
|
|
It is on top of the article:
typedef ITaskbarList *LPITaskbarList
|
|
|
|
|
Hi,
Here is the good declaration of the ITaskbarList interface:
DECLARE_INTERFACE_(ITaskbarList, IUnknown)
{
STDMETHOD (HrInit) (THIS) PURE;
STDMETHOD (AddTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (DeleteTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (ActivateTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (SetActiveAlt) (THIS_ HWND hwnd) PURE;
};
typedef ITaskbarList *LPITaskbarList;
HrInit() has no parameter (Cf. http://msdn.microsoft.com/en-us/library/bb774652%28v=vs.85%29.aspx[^])
Here you can find a small example:
- Create a new MFC project named TestITaskbarList
- select Dialog based
- Click Next, ..., Next, Finish
- add a button and double click on it
- Save the project
- update the TestITaskbarListDlg.h file:
#if !defined(AFX_TESTITASKBARLISTDLG_H__)
#define AFX_TESTITASKBARLISTDLG_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
DECLARE_INTERFACE_(ITaskbarList, IUnknown)
{
STDMETHOD (HrInit) (THIS) PURE;
STDMETHOD (AddTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (DeleteTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (ActivateTab) (THIS_ HWND hwnd) PURE;
STDMETHOD (SetActiveAlt) (THIS_ HWND hwnd) PURE;
};
typedef ITaskbarList *LPITaskbarList;
class CTestITaskbarListDlg : public CDialog
{
public:
CTestITaskbarListDlg(CWnd* pParent = NULL);
enum { IDD = IDD_TESTITASKBARLIST_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
HICON m_hIcon;
LPITaskbarList pTaskbar;
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnButton1();
DECLARE_MESSAGE_MAP()
};
#endif // !defined(AFX_TESTITASKBARLISTDLG_H__)
- update the TestITaskbarListDlg.cpp file:
CTestITaskbarListDlg::CTestITaskbarListDlg(CWnd* pParent )
: CDialog(CTestITaskbarListDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
pTaskbar = NULL;
}
...
...
BEGIN_MESSAGE_MAP(CTestITaskbarListDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
END_MESSAGE_MAP()
...
...
BOOL CTestITaskbarListDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
HRESULT hRes = ::CoInitialize(0);
if ( hRes != S_OK )
{
::AfxMessageBox("*** Error: Problem to initialize the COM library !");
::PostQuitMessage(0);
}
::CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_SERVER, IID_ITaskbarList, (void**)&pTaskbar);
if ( hRes != S_OK )
{
::AfxMessageBox("*** Error: Problem to create a single instance of the task bar list !");
::PostQuitMessage(0);
}
hRes = pTaskbar->HrInit();
if ( hRes != S_OK )
{
::AfxMessageBox("*** Error: Problem to initialize the COM instance !");
::PostQuitMessage(0);
}
return TRUE;
}
...
...
void CTestITaskbarListDlg::OnButton1()
{
if ( NOERROR != pTaskbar->DeleteTab(m_hWnd) )
{
TRACE("*** Error: Problem to delete tab from the Task bar !!!");
}
}
Click the button. The tab disappears.
Hope it can help.
|
|
|
|
|
it does not work the way it is supposed to
|
|
|
|
|
Hi,
I have written a small app to hide Windows Media Player's taskbar button, as i can't find a program / option anywhere that does this for me. However it's a floating skin, that's always on top. Now I manage to hide the taskbar button, however when I click the application it comes back. Is there a good workaround for this?
Thanks,
|
|
|
|
|
The title of a taskbar entry should be different from to the application title.
How can I achieve this ?
|
|
|
|
|
From MSDN,
The shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.
|
|
|
|
|
WS_EX_TOOLWINDOW !!!!
awsome.. I've been tryin to hide a task bar icon for a while, but non of the methods i found felt to be the good resolution.. All ya gotta do is create the darn window with WS_EX_TOOLWINDOW extended style.. Excellent.. Thank you.
|
|
|
|
|
im running windows xp and would like to hide netmeet window and taskbar
i dont know anything about this so could someone explain step by step details on this example : what file do you start with exact names of the files and what do you add or take off?
thanks
juniorharvell@hotmail.com
|
|
|
|
|
To hide all windows in a process you can use EnumThreadWindows API. You will have to supply pointer to EnumThreadWndProc function. This function is a callback and you will receive windows handle as parameter. Use ShowWindow API inside the callback function to hide the window and the ITaskbatList interface to remove the window from the taskbar.
Milind Shingade
|
|
|
|
|
it would be more clear if you can provide the source code and sample in vc 6.0.
|
|
|
|
|
Hello,
I'm seeing your example to hide the taskbar's button.
It seems to work.
I say "seems" becouse after call "pTaskbar->DeleteTab(...)" the button on the Taskbar disappear, but on repaint it is still visible.
Do you have some suggestions to give me?
I thanks you very much
and you must forgive me for my bad english.
Bye
Remo
|
|
|
|
|
Even though you said, "Forgive me if this article doesn't explain much." What you should have done, is, "explain much," because you're asking readers to take what you have posted, "on faith"; that it will work!
Well what happens if doesn't work in ALL instances? What do those readers have to fall back on to help in finding out why it didn't work for them!
It's really generous of you to want to share this piece of knowledge with the community, but as professionals and technical people, "goodness of the heart" doesn't work for the computer. That machine can be very unforgiving, and a source of unbearable stress!!
William
Fortes in fide et opere!
|
|
|
|
|
I've updated it (a little) but I am completely out of Ideas now on how to documentate well.
I've been using this for my apps, and it works. Of course it works.
Programming or Die?
----C++ 4 ever-----
|
|
|
|
|
I don't understand the part where you say "annoying box in the taskbar". Wouldn't it really annoy users if the program didn't appear on the taskbar? Wouldn't it be confusing?
Perhaps you are talking about a valid scenario, but without an explanation from you I am left confused.
|
|
|
|
|
I said Sometimes
this may happen if, for example, you want to make a desktop clock, or desktop calender, or any other "floating" kind of applications.
Programming or Die?
----C++ 4 ever-----
|
|
|
|
|
Yes, I have a media player that I minimize to tray, but the window still remained in the taskbar. Thanks!
Best regards,
Balder
|
|
|
|