Files
NetVizor/Shell/Utils/TaskbarHelper.cs
T
jimmy 42464d9408 A: 添加任务栏窗口界面 (TaskbarWindow.xaml) 以显示实时网络流量;新增工具类 TaskbarHelper 获取任务栏位置
A: README 更新,详述功能清单及说明
A: 添加图片资源(img.png, img_1.png, img_2.png, img_3.png)
D: 移除 MainWindow.xaml.cs 中无用引用
2025-05-11 15:49:11 +08:00

36 lines
895 B
C#

namespace Shell.Utils;
using System;
using System.Runtime.InteropServices;
public static class TaskbarHelper
{
[DllImport("shell32.dll", SetLastError = true)]
static extern UInt32 SHAppBarMessage(UInt32 dwMessage, ref APPBARDATA pData);
[StructLayout(LayoutKind.Sequential)]
public struct APPBARDATA
{
public UInt32 cbSize;
public IntPtr hWnd;
public UInt32 uCallbackMessage;
public UInt32 uEdge;
public RECT rc;
public Int32 lParam;
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left, top, right, bottom;
}
public static RECT GetTaskbarPosition()
{
APPBARDATA data = new APPBARDATA();
data.cbSize = (UInt32)Marshal.SizeOf(typeof(APPBARDATA));
SHAppBarMessage(0x00000005, ref data); // ABM_GETTASKBARPOS
return data.rc;
}
}