TaskBarList.cs (3303B)
1 using System; 2 using System.Runtime.InteropServices; 3 4 namespace LanTool.Classes 5 { 6 [ComImportAttribute()] 7 [GuidAttribute("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")] 8 [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] 9 interface ITaskbarList3 10 { 11 [PreserveSig] 12 void HrInit(); 13 [PreserveSig] 14 void AddTab(IntPtr hwnd); 15 [PreserveSig] 16 void DeleteTab(IntPtr hwnd); 17 [PreserveSig] 18 void ActivateTab(IntPtr hwnd); 19 [PreserveSig] 20 void SetActiveAlt(IntPtr hwnd); 21 22 [PreserveSig] 23 void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); 24 25 void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal); 26 void SetProgressState(IntPtr hwnd, TBPFLAG tbpFlags); 27 void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); 28 void UnregisterTab(IntPtr hwndTab); 29 void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); 30 void SetTabActive(IntPtr hwndTab, IntPtr hwndMDI, TBATFLAG tbatFlags); 31 void ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons); 32 void ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons); 33 void ThumbBarSetImageList(IntPtr hwnd, IntPtr himl); 34 void SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string pszDescription); 35 void SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTip); 36 void SetThumbnailClip(IntPtr hwnd, ref RECT prcClip); 37 } 38 [GuidAttribute("56FDF344-FD6D-11d0-958A-006097C9A090")] 39 [ClassInterfaceAttribute(ClassInterfaceType.None)] 40 [ComImportAttribute()] 41 class TaskbarList { } 42 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 43 struct THUMBBUTTON 44 { 45 [MarshalAs(UnmanagedType.U4)] 46 public THBMASK dwMask; 47 public uint iId; 48 public uint iBitmap; 49 public IntPtr hIcon; 50 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] 51 public string szTip; 52 [MarshalAs(UnmanagedType.U4)] 53 public THBFLAGS dwFlags; 54 } 55 enum THBMASK 56 { 57 THB_BITMAP = 0x1, 58 THB_ICON = 0x2, 59 THB_TOOLTIP = 0x4, 60 THB_FLAGS = 0x8 61 } 62 63 enum THBFLAGS 64 { 65 THBF_ENABLED = 0, 66 THBF_DISABLED = 0x1, 67 THBF_DISMISSONCLICK = 0x2, 68 THBF_NOBACKGROUND = 0x4, 69 THBF_HIDDEN = 0x8 70 } 71 enum TBPFLAG 72 { 73 TBPF_NOPROGRESS = 0, 74 TBPF_INDETERMINATE = 0x1, 75 TBPF_NORMAL = 0x2, 76 TBPF_ERROR = 0x4, 77 TBPF_PAUSED = 0x8 78 } 79 enum TBATFLAG 80 { 81 TBATF_USEMDITHUMBNAIL = 0x1, 82 TBATF_USEMDILIVEPREVIEW = 0x2 83 } 84 struct RECT 85 { 86 public int left; 87 public int top; 88 public int right; 89 public int bottom; 90 91 [System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", 92 Justification = "False positive" )] 93 public RECT(int left, int top, int right, int bottom) 94 { 95 this.left = left; 96 this.top = top; 97 this.right = right; 98 this.bottom = bottom; 99 } 100 } 101 }