如何在Windows应用程序中准确地获得TaskBar的大小(高度)和位置?
发布于 2015-03-29 17:33:47
如下所示:
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left; // x position of upper-left corner
public int Top; // y position of upper-left corner
public int Right; // x position of lower-right corner
public int Bottom; // y position of lower-right corner
}如何获取taskbar的位置和大小
//Get the handle of the task bar
IntPtr TaskBarHandle;
TaskBarHandle = FindWindow("Shell_traywnd", "");
RECT rct;
//Get the taskbar window rect in screen coordinates
GetWindowRect(TaskBarHandle, out rct);https://stackoverflow.com/questions/29330440
复制相似问题