/// <summary>
        /// Unregisters an appbar.
        /// </summary>
        public void Unregister()
        {
            APPBARDATA msgData = new APPBARDATA();
            msgData.cbSize = Marshal.SizeOf(msgData);
            msgData.hWnd = _handle;

            Win32AppBar.SHAppBarMessage(ABM.ABM_REMOVE, ref msgData);
        }
        /// <summary>
        /// Retrieves the handle to the appbar associated to the edge of the screen.
        /// </summary>
        /// <returns>
        /// Returns the handle to the autohide appbar. The return value is 0 if an error occurs or 
        /// if no autohide appbar is associated with the given edge.
        /// </returns>
        public IntPtr GetAutoHide(DockPosition dock)
        {
            APPBARDATA msgData = new APPBARDATA();
            msgData.cbSize = Marshal.SizeOf(msgData);
            msgData.hWnd = _handle;
            msgData.uEdge = (uint)dock.ToNative();

            return Win32AppBar.SHAppBarMessage(ABM.ABM_GETAUTOHIDEBAR, ref msgData);
        }
 /// <summary>
 /// Registers a new appbar.
 /// </summary>
 /// <returns>Returns true if successful, otherwise false</returns>
 public bool Register()
 {
     APPBARDATA msgData = new APPBARDATA();
     msgData.cbSize = Marshal.SizeOf(msgData);
     msgData.hWnd = _handle;
     msgData.uCallbackMessage = _callback;
     
     return Win32AppBar.SHAppBarMessage(ABM.ABM_NEW, ref msgData).ToInt32() == Win32.TRUE;
 }
Exemplo n.º 4
0
 public static IntPtr SHAppBarMessage(ABM message, ref APPBARDATA data)
 {
     return NativeMethods.SHAppBarMessage((uint)message, ref data);
 }
Exemplo n.º 5
0
 public static extern IntPtr SHAppBarMessage(uint dwMessage, ref APPBARDATA pData);
        /// <summary>
        /// Registers or unregisters an autohide appbar for an edge of the screen.
        /// </summary>
        /// <returns>
        /// Returns true if successful, or false if an error occurs or         
        /// if an autohide appbar is already registered for the given edge.
        /// </returns>
        public bool SetAutoHide(DockPosition dock, bool autohide)
        {
            APPBARDATA msgData = new APPBARDATA();
            msgData.cbSize = Marshal.SizeOf(msgData);
            msgData.hWnd = _handle;
            msgData.lParam = autohide ? Win32.TRUE : Win32.FALSE;
            msgData.uEdge = (uint)dock.ToNative();

            return Win32AppBar.SHAppBarMessage(ABM.ABM_SETAUTOHIDEBAR, ref msgData).ToInt32() == Win32.TRUE;
        }
        /// <summary>
        /// Notifies the system when an appbar's position has changed. 
        /// </summary>
        void OnWindowPositionChanged()
        {
            APPBARDATA msgData = new APPBARDATA();
            msgData.cbSize = Marshal.SizeOf(msgData);
            msgData.hWnd = _handle;

            Win32AppBar.SHAppBarMessage(ABM.ABM_WINDOWPOSCHANGED, ref msgData);
        }
        /// <summary>
        /// Notifies the system that an appbar has been activated. 
        /// </summary>
        void OnActivate()
        {
            APPBARDATA msgData = new APPBARDATA();
            msgData.cbSize = Marshal.SizeOf(msgData);
            msgData.hWnd = _handle;

            Win32AppBar.SHAppBarMessage(ABM.ABM_ACTIVATE, ref msgData);
        }
        public Position GetTaskbarPosition()
        {
            APPBARDATA msgData = new APPBARDATA();
            msgData.cbSize = Marshal.SizeOf(msgData);

            Win32AppBar.SHAppBarMessage(ABM.ABM_GETTASKBARPOS, ref msgData);
            return Position.FromNative(ref msgData.rc);
        }
        /// <summary>
        /// <para>
        ///     Sets the size and screen position of an appbar. The message specifies a 
        ///     screen edge and the bounding rectangle for the appbar. 
        /// </para>
        /// <para>
        ///     The system may adjust the bounding rectangle so that the appbar does not 
        ///     interfere with the Windows taskbar or any other appbars.
        /// </para>
        /// </summary>
        public void SetPosition(ref Position position, DockPosition dock)
        {
            APPBARDATA msgData = new APPBARDATA();
            msgData.cbSize = Marshal.SizeOf(msgData);
            msgData.hWnd = _handle;
            msgData.uEdge = (uint)dock.ToNative();
            position.ToNative(ref msgData.rc);

            Win32AppBar.SHAppBarMessage(ABM.ABM_SETPOS, ref msgData);
            position = Position.FromNative(ref msgData.rc);
        }