/// <summary> /// The get position. /// </summary> /// <param name="className">The class name.</param> /// <param name="windowName">The window name.</param> public void GetPosition(string className, string windowName) { this.data = new AppBarData(); this.data.Size = (uint)Marshal.SizeOf(this.data.GetType()); var wnd = NativeMethods.FindWindow(className, windowName); if (wnd != IntPtr.Zero) { var result = NativeMethods.SHAppBarMessage(AbmGettaskbarpos, ref this.data); if (result.ToUInt64() != 1) { throw new BaseException(Resources.FailedToCommunicateWithTheGivenAppBar); } } else { throw new BaseException(Resources.FailedToFindAnAppBarThatMatchedTheGivenCriteria); } }
public static extern UIntPtr SHAppBarMessage(uint dwMessage, ref AppBarData data);