예제 #1
0
        private Boolean AppbarNew()
        {
            if (CallbackMessageID == 0)
            {
                throw new Exception("CallbackMessageID is 0");
            }

            if (IsAppbarMode)
            {
                return(true);
            }

            m_PrevSize     = Size;
            m_PrevLocation = Location;

            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize           = (UInt32)Marshal.SizeOf(msgData);
            msgData.hWnd             = Handle;
            msgData.uCallbackMessage = CallbackMessageID;

            // install new appbar
            UInt32 retVal = ShellApi.SHAppBarMessage((UInt32)AppBarMessages.New, ref msgData);

            IsAppbarMode = (retVal != 0);

            SizeAppBar();

            return(IsAppbarMode);
        }
예제 #2
0
        private void AppbarGetTaskbarPos(out ShellApi.RECT taskRect)
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);

            // get taskbar position
            ShellApi.SHAppBarMessage((UInt32)AppBarMessages.GetTaskBarPos, ref msgData);
            taskRect = msgData.rc;
        }
예제 #3
0
        private void AppbarSetTaskbarState(AppBarStates state)
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
            msgData.lParam = (Int32)state;

            // set taskbar state
            ShellApi.SHAppBarMessage((UInt32)AppBarMessages.SetState, ref msgData);
        }
예제 #4
0
        private void AppbarWindowPosChanged()
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
            msgData.hWnd   = Handle;

            // send windowposchanged to the system
            ShellApi.SHAppBarMessage((UInt32)AppBarMessages.WindowPosChanged, ref msgData);
        }
예제 #5
0
        private void AppbarActivate()
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
            msgData.hWnd   = Handle;

            // send activate to the system
            ShellApi.SHAppBarMessage((UInt32)AppBarMessages.Activate, ref msgData);
        }
예제 #6
0
        private AppBarStates AppbarGetTaskbarState()
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);

            // get taskbar state
            UInt32 retVal = ShellApi.SHAppBarMessage((UInt32)AppBarMessages.GetState, ref msgData);

            return((AppBarStates)retVal);
        }
예제 #7
0
        private IntPtr AppbarGetAutoHideBar(AppBarEdges edge)
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
            msgData.uEdge  = (UInt32)edge;

            // get auto hide
            IntPtr retVal = (IntPtr)ShellApi.SHAppBarMessage((UInt32)AppBarMessages.GetAutoHideBar, ref msgData);

            return(retVal);
        }
예제 #8
0
        private void AppbarSetPos(ref ShellApi.RECT appRect)
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
            msgData.hWnd   = Handle;
            msgData.uEdge  = (UInt32)m_Edge;
            msgData.rc     = appRect;

            // set postion for the appbar
            ShellApi.SHAppBarMessage((UInt32)AppBarMessages.SetPos, ref msgData);
            appRect = msgData.rc;
        }
예제 #9
0
        private Boolean AppbarSetAutoHideBar(Boolean hideValue)
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
            msgData.hWnd   = Handle;
            msgData.uEdge  = (UInt32)m_Edge;
            msgData.lParam = (hideValue) ? 1 : 0;

            // set auto hide
            UInt32 retVal = ShellApi.SHAppBarMessage((UInt32)AppBarMessages.SetAutoHideBar, ref msgData);

            return((retVal != 0) ? true : false);
        }
예제 #10
0
        private Boolean AppbarRemove()
        {
            // prepare data structure of message
            ShellApi.APPBARDATA msgData = new ShellApi.APPBARDATA();
            msgData.cbSize = (UInt32)Marshal.SizeOf(msgData);
            msgData.hWnd   = Handle;

            // remove appbar
            UInt32 retVal = ShellApi.SHAppBarMessage((UInt32)AppBarMessages.Remove, ref msgData);

            IsAppbarMode = false;

            Size     = m_PrevSize;
            Location = m_PrevLocation;

            return((retVal != 0) ? true : false);
        }