![]() HWnd = FindWindow(Taskbar.ClassName, null) Private const string ClassName = "Shell_TrayWnd" ĬbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA)), * Description: Class to get the taskbar's position, size and other properties. The code with all subsequent updates is available as a gist at. The only limitation I know of so far is that it does not return the correct bounds when multiple monitors are set to display in extended mode. Output: top:1040 left:0 bottom:1080 right:1920 width:1920 īased on David's answer, here is a better implementation that uses P/Invoke to correctly determine the placement and size of the taskbar. ![]() SHAppBarMessage((UInt32)0x00000005, ref msgData) Ĭonsole.WriteLine("top:" + taskRect.top + " left:" + taskRect.left + " bottom:" + taskRect.bottom + " right:" + taskRect.right) Ĭonsole.WriteLine("width:" + (taskRect.right - taskRect.left) + " height:" + (taskRect.bottom - taskRect.top)) Private void Form1_Load(object sender, EventArgs e) Public static extern UInt32 SHAppBarMessage(UInt32 dwMessage, ref APPBARDATA pData)
0 Comments
Leave a Reply. |