Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type
Const tBarClass = "Shell_TrayWnd"
Dim tBarHwnd As Long Dim tBarRect As RECT
Private Sub Command1_Click() ' узнать handle ТаскБара tBarHwnd = FindWindow(tBarClass, "") If tBarHwnd = 0 Then MsgBox "Указанное окно не найдено!", 0 Else ' Окно найдено, идет определение местоположения taskbar GetWindowRect tBarHwnd, tBarRect If tBarRect.Left = -2 And tBarRect.Top > -2 Then ' Taskbar внизу экрана MsgBox "Taskbar Is at the bottom of the screen.." End If If tBarRect.Left > -2 And tBarRect.Bottom = Screen.height / Screen.TwipsPerPixelY + 2 Then ' Taskbar справа от экрана MsgBox "Taskbar Is aligned at the right of the screen.." End If If tBarRect.Bottom <> Screen.height / Screen.TwipsPerPixelY + 2 And tBarRect.Right = Screen.Width / Screen.TwipsPerPixelX + 2 Then ' Taskbar сверху экрана MsgBox "Taskbar Is at the top of the screen.." End If If tBarRect.Right <> Screen.Width / Screen.TwipsPerPixelX + 2 And tBarRect.Bottom = Screen.height / Screen.TwipsPerPixelY + 2 Then ' Taskbar слева от экрана MsgBox "Taskbar Is aligned at the left of the screen.." End If End If End Sub
Если Вас заинтересовала или понравилась информация программирование на Visual Basic - "Определение местоположение TaskBar", Вы можете поставить закладку в социальной сети или в своём блоге на данную страницу: Так же Вы можете задать вопрос по работе этого модуля или примера через форму обратной связи, в сообщение обязательно указывайте название или ссылку на статью!