Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than shell32, prefix the name with the module name and a period.
ITaskbarList (shell32)
.
C# Signature:
[ComImport,
Guid("56fdf342-fd6d-11d0-958a-006097c9a090"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITaskbarList
{
/// <summary>
/// Initializes the taskbar list object. This method must be called before any other ITaskbarList methods can be called.
/// </summary>
void HrInit();
/// <summary>
/// Adds an item to the taskbar.
/// </summary>
/// <param name="hWnd">A handle to the window to be added to the taskbar.</param>
void AddTab([In] IntPtr hWnd);
/// <summary>
/// Deletes an item from the taskbar.
/// </summary>
/// <param name="hWnd">A handle to the window to be deleted from the taskbar.</param>
void DeleteTab([In] IntPtr hWnd);
/// <summary>
/// Activates an item on the taskbar. The window is not actually activated; the window's item on the taskbar is merely displayed as active.
/// </summary>
/// <param name="hWnd">A handle to the window on the taskbar to be displayed as active.</param>
void ActivateTab([In] IntPtr hWnd);
/// <summary>
/// Marks a taskbar item as active but does not visually activate it.
/// </summary>
/// <param name="hWnd">A handle to the window to be marked as active.</param>
void SetActiveAlt([In] IntPtr hWnd);
}
[ComImport]
[Guid("56fdf344-fd6d-11d0-958a-006097c9a090")]
public class CoTaskbarList
{
}
VB Signature:
Declare Function ITaskbarList Lib "shell32.dll" (TODO) As TODO
VB.NET full Implementation:
Since I wanted this to work on x64 and x86 Plattforms I used the IntPtr based approach.
It works perfect using Windows7 (64) - in WinXP the Taskbar-Items tend to reappear after a while after hiding them.
Don't forget to Import System.Runtime.CompilerServices and System.Runtime.InteropServices
<ComImport, TypeLibType(CShort(2)), Guid("56FDF344-FD6D-11D0-958A-006097C9A090"), ClassInterface(CShort(0))> _
Public Class TaskbarListClass
Implements ITaskbarList, TaskbarList
' Methods
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Public Sub New()
End Sub
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Public Overridable Sub ActivateTab(<[In]> ByVal hwnd As IntPtr) Implements ITaskbarList.ActivateTab
End Sub
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Public Overridable Sub AddTab(<[In]> ByVal hwnd As IntPtr) Implements ITaskbarList.AddTab
End Sub
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Public Overridable Sub DeleteTab(<[In]> ByVal hwnd As IntPtr) Implements ITaskbarList.DeleteTab
End Sub
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Public Overridable Sub HrInit() Implements ITaskbarList.HrInit
End Sub
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Public Overridable Sub SetActivateAlt(<[In]> ByVal hwnd As IntPtr) Implements ITaskbarList.SetActivateAlt
End Sub
End Class
<ComImport, Guid("56FDF342-FD6D-11D0-958A-006097C9A090"), CoClass(GetType(TaskbarListClass))> _
Public Interface TaskbarList
Inherits ITaskbarList
End Interface
<ComImport, InterfaceType(CShort(1)), Guid("56FDF342-FD6D-11D0-958A-006097C9A090")> _
Public Interface ITaskbarList
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Sub HrInit()
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Sub AddTab(<[In]> ByVal hwnd As IntPtr)
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Sub DeleteTab(<[In]> ByVal hwnd As IntPtr)
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Sub ActivateTab(<[In]> ByVal hwnd As IntPtr)
<MethodImpl(MethodImplOptions.InternalCall, MethodCodeType:=MethodCodeType.Runtime)> _
Sub SetActivateAlt(<[In]> ByVal hwnd As IntPtr)
End Interface
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).