Sends an appbar message to the system.
Code:Const ABS_AUTOHIDE As Int32 = 1 Const ABS_ONTOP As Int32 = 2 Const ABM_NEW As Int32 = 0 Const ABM_REMOVE As Int32 = 1 Const ABM_QUERYPOS As Int32 = 2 Const ABM_SETPOS As Int32 = 3 Const ABM_GETSTATE As Int32 = 4 Const ABM_GETTASKBARPOS As Int32 = 5 Const ABM_ACTIVATE As Int32 = 6 Const ABM_GETAUTOHIDEBAR As Int32 = 7 Const ABM_SETAUTOHIDEBAR As Int32 = 8 Const ABM_WINDOWPOSCHANGED As Int32 = 9 Private Declare Function apiSHAppBarMessage Lib "shell32" Alias "SHAppBarMessage" (ByVal dwMessage As Int32, ByRef pData As APPBARDATA) As Int32 Private Structure RECT Public rLeft, rTop, rRight, rBottom As Int32 End Structure Private Structure APPBARDATA Public cbSize, hwnd, uCallbackMessage, uEdge As Int32, rc As RECT, lParam As Int32 End Structure Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ABD As New APPBARDATA apiSHAppBarMessage(ABM_GETTASKBARPOS, ABD) 'Get the taskbar's position MessageBox.Show("Left:" & ABD.rc.rLeft.ToString & " Top:" & ABD.rc.rTop.ToString & " Right:" & ABD.rc.rRight.ToString & " Bottom:" & ABD.rc.rBottom.ToString) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim Ret As Int32 = apiSHAppBarMessage(ABM_GETSTATE, Nothing) 'Get the taskbar's state If Ret = ABS_ONTOP Then MessageBox.Show("Always on top option is on. Autohide option is off.") ElseIf Ret = ABS_AUTOHIDE Then MessageBox.Show("Always on top option is off. Autohide option is on.") ElseIf Ret = ABS_ONTOP + ABS_AUTOHIDE Then MessageBox.Show("Always on top option is on. Autohide option is on.") ElseIf Ret = 0 Then MessageBox.Show("Always on top option is off. Autohide option is off.") End If End Sub


Reply With Quote
Bookmarks