'Sends an appbar message to the system.
'给你一段代码吧Const ABS_AUTOHIDE = &H1
Const ABS_ONTOP = &H2
Const ABM_GETSTATE = &H4
Const ABM_GETTASKBARPOS = &H5
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long ' message specific
End Type
Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
Private Sub Form_Paint()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim ABD As APPBARDATA, Ret As Long
'Get the taskbar's position
SHAppBarMessage ABM_GETTASKBARPOS, ABD
'Get the taskbar's state
Ret = SHAppBarMessage(ABM_GETSTATE, ABD)
If (Ret And ABS_AUTOHIDE) Then Me.Print "Autohide option is on"
If (Ret And ABS_ONTOP) Then Me.Print "Always on top option is on"
Me.Print "Taskbar coordinates: (" + Trim(Str(ABD.rc.Left)) + "," + Trim(Str(ABD.rc.Top)) + ")-(" + Trim(Str(ABD.rc.Right)) + "," + Trim(Str(ABD.rc.Bottom)) + ")"
End Sub
'给你一段代码吧Const ABS_AUTOHIDE = &H1
Const ABS_ONTOP = &H2
Const ABM_GETSTATE = &H4
Const ABM_GETTASKBARPOS = &H5
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long ' message specific
End Type
Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
Private Sub Form_Paint()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim ABD As APPBARDATA, Ret As Long
'Get the taskbar's position
SHAppBarMessage ABM_GETTASKBARPOS, ABD
'Get the taskbar's state
Ret = SHAppBarMessage(ABM_GETSTATE, ABD)
If (Ret And ABS_AUTOHIDE) Then Me.Print "Autohide option is on"
If (Ret And ABS_ONTOP) Then Me.Print "Always on top option is on"
Me.Print "Taskbar coordinates: (" + Trim(Str(ABD.rc.Left)) + "," + Trim(Str(ABD.rc.Top)) + ")-(" + Trim(Str(ABD.rc.Right)) + "," + Trim(Str(ABD.rc.Bottom)) + ")"
End Sub
解决方案 »
- 介绍一款适合VB二次开发的摄像头
- datagrid没有显示数据
- listbox中如何将其中item显示为灰色的,并不可以选择 急急急急急急急急急急!
- 关于MDI窗体?合适,马上给分
- 关于MSHFLEXGRID
- 问个最简单的。msgbox的问题
- 有谁用VB6做过HTTP上传文件吗,用Microsoft.XMLHTTP或者其它组件,上传到.NET或者JAVA的WEB服务器
- 如何判断一个控件是否被另一个控件覆盖(就是说被覆盖的控件不能完全显示了)
- 一个编译的问题,望大虾帮忙。
- True Dbgrid Pro 7.0的问题
- 关于文件上传和变量值上传的冲突
- Crystal Report 中能不能实现这种形式的打印??
Public Const ABM_NEW = &H0
Public Const ABM_REMOVE = &H1
Public Const ABM_QUERYPOS = &H2
Public Const ABM_SETPOS = &H3
Public Const ABM_GETSTATE = &H4
Public Const ABM_GETTASKBARPOS = &H5
Public Const ABM_ACTIVATE = &H6
Public Const ABM_GETAUTOHIDEBAR = &H7
Public Const ABM_SETAUTOHIDEBAR = &H8
Public Const ABM_WINDOWPOSCHANGED = &H9Public Const ABN_STATECHANGE = &H0
Public Const ABN_POSCHANGED = &H1
Public Const ABN_FULLSCREENAPP = &H2
Public Const ABN_WINDOWARRANGE = &H3Public Const ABS_AUTOHIDE = &H1
Public Const ABS_ALWAYSONTOP = &H2Public Const ABE_LEFT = 0
Public Const ABE_TOP = 1
Public Const ABE_RIGHT = 2
Public Const ABE_BOTTOM = 3Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypeType APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long 'message specific
End TypeDeclare Function SHAppBarMessage Lib "shell32" _
(ByVal dwMessage As Long, _
pData As APPBARDATA) As Long
'----------------------------------------------
' Form
'To a form containing a command button (Command1) and a text box (Text1). Set the textbox to multiline and the scrollbars to 2 - Vertical, and add the following codeOption ExplicitPrivate Sub Command1_Click() Dim rc As RECT
Dim ABD As APPBARDATA
Dim state As Long
Dim position As Integer
Dim hWndAppBar As Long
Dim msg As String
'initialize the APPBARDATA structure
ABD.cbSize = Len(ABD)
'get the appbar state
state = SHAppBarMessage(ABM_GETSTATE, ABD)
'prepare the appropriate message based on the returned state
msg = "SHAppBarMessage ABM_GETSTATE return value is " & state & ":" & vbCrLf & vbCrLf
Select Case state
Case False
msg = msg & " - Auto Hide= False, Always on Top = False." & vbCrLf
msg = msg & " - User allows apps cover the taskbar." & vbCrLf
msg = msg & " - The taskbar must be manually invoked with maximized apps."
Case ABS_ALWAYSONTOP
msg = msg & " - Always on Top = True." & vbCrLf
msg = msg & " - User wants the taskbar on-screen at all times." & vbCrLf
msg = msg & " - The available screen is reduced by the taskbar size."
Case Else
msg = msg & " - Auto Hide = True." & vbCrLf
msg = msg & " - The taskbar appears on a mousemove." & vbCrLf
msg = msg & " - There are taskbar(s) positioned on the "
'see which edge has a taskbar
For position = ABE_LEFT To ABE_BOTTOM
ABD.uEdge = position
hWndAppBar = SHAppBarMessage(ABM_GETAUTOHIDEBAR, ABD)
If hWndAppBar > 0 Then
Select Case position
Case ABE_LEFT: msg = msg & "LEFT "
Case ABE_TOP: msg = msg & "TOP "
Case ABE_RIGHT: msg = msg & "RIGHT "
Case ABE_BOTTOM: msg = msg & "BOTTOM "
End Select
End If
Next
End Select
'display the results
Text1.Text = msg
End Sub
不过,我的问题是新register一个appBar失败,我找不出原因