API的问题

wenlz 2003-01-09 07:35:20
有谁知道这个API函数的用法和功能吗?SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long,请各位指教!!
...全文
10 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyl910 2003-01-09
SHAppBarMessage


WINSHELLAPI UINT APIENTRY SHAppBarMessage(
DWORD dwMessage,
PAPPBARDATA pData
);

Sends an appbar message to the system.

Returns a message-dependent value. For more information, see the Microsoft Platform SDK documentation for the appbar message sent.
dwMessage
Appbar message value to send. This parameter can be one of the following values: ABM_ACTIVATE Notifies the system that an appbar has been activated.
ABM_GETAUTOHIDEBAR Retrieves the handle to the autohide appbar associated with a particular edge of the screen.
ABM_GETSTATE Retrieves the autohide and always-on-top states of the Windows taskbar.
ABM_GETTASKBARPOS Retrieves the bounding rectangle of the Windows taskbar.
ABM_NEW Registers a new appbar and specifies the message identifier that the system should use to send notification messages to the appbar.
ABM_QUERYPOS Requests a size and screen position for an appbar.
ABM_REMOVE Unregisters an appbar, removing the bar from the system's internal list.
ABM_SETAUTOHIDEBAR Registers or unregisters an autohide appbar for an edge of the screen.
ABM_SETPOS Sets the size and screen position of an appbar.
ABM_WINDOWPOSCHANGED Notifies the system when an appbar's position has changed.

pData
Address of an APPBARDATA structure. The content of the structure depends on the value set in the dwMessage parameter.





APPBARDATA


typedef struct _AppBarData {
DWORD cbSize;
HWND hWnd;
UINT uCallbackMessage;
UINT uEdge;
RECT rc;
LPARAM lParam;
} APPBARDATA, *PAPPBARDATA;

Contains information about a system appbar message. This structure is used with the SHAppBarMessage function.

cbSize
Contains the size of the structure, in bytes.
hWnd
Contains the handle to the appbar window.
uCallbackMessage
Application-defined message identifier. The application uses the specified identifier for notification messages that it sends to the appbar identified by the hWnd member. This member is used when sending the ABM_NEW message.
uEdge
Value that specifies an edge of the screen. This member can be one of the following values: ABE_BOTTOM Bottom edge.
ABE_LEFT Left edge.
ABE_RIGHT Right edge.
ABE_TOP Top edge.

This member is used when sending the ABM_GETAUTOHIDEBAR, ABM_QUERYPOS, ABM_SETAUTOHIDEBAR, and ABM_SETPOS messages.

rc
RECT structure to contain the bounding rectangle, in screen coordinates, of an appbar or the Windows taskbar. This member is used when sending the ABM_GETTASKBARPOS, ABM_QUERYPOS, and ABM_SETPOS messages.
lParam
Message-dependent value. This member is used with the ABM_SETAUTOHIDEBAR message.
回复
starbaby 2003-01-09
我这里也有一个:(我找到的,希望对你有帮助)
如何製作簡單的工作列

這首先得向Windows註冊一個工作列的區域,Windows才會空出一個區域,在視窗最大化時才不會蓋住 程式如下


'以下程式在Form中 需要4個Command1(就是Command1的陣列)
'-----------------------------------------------------------------------------------------------------
Private Const ABM_NEW = &H0
Private Const ABM_REMOVE = &H1
Private Const ABM_SETPOS = &H3
Private Const ABM_ACTIVATE = &H6

Private Const ABE_LEFT = 0
Private Const ABE_TOP = 1
Private Const ABE_RIGHT = 2
Private Const ABE_BOTTOM = 3

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
End Type

Private Declare Function SHAppBarMessage Lib "shell32.dll" _
(ByVal dwMessage As Long, _
pData As APPBARDATA) As Long
Dim pData As APPBARDATA

Private Sub Command1_Click(Index As Integer)
If Index = 0 Then 'Left
pData.rc.Left = -2
pData.rc.Top = -2
pData.rc.Right = Me.Width / Screen.TwipsPerPixelX
pData.rc.Bottom = Me.Height / Screen.TwipsPerPixelY
pData.uEdge = ABE_LEFT '設定位置在左方
ElseIf Index = 1 Then 'Top
pData.rc.Left = -2
pData.rc.Top = -2
pData.rc.Right = Me.Width / Screen.TwipsPerPixelX
pData.rc.Bottom = Me.Height / Screen.TwipsPerPixelY
pData.uEdge = ABE_TOP '設定位置在上方
ElseIf Index = 2 Then 'Right
pData.rc.Left = (Screen.Width - Me.Width) \ Screen.TwipsPerPixelX
pData.rc.Top = -2
pData.rc.Right = Screen.Width \ Screen.TwipsPerPixelX
pData.rc.Bottom = Me.Height \ Screen.TwipsPerPixelY
pData.uEdge = ABE_RIGHT '設定位置在右方
ElseIf Index = 3 Then 'Bottom
pData.rc.Left = -2
pData.rc.Top = (Screen.Height - Me.Height) \ Screen.TwipsPerPixelY
pData.rc.Right = Me.Width \ Screen.TwipsPerPixelX
pData.rc.Bottom = Screen.Height \ Screen.TwipsPerPixelY
pData.uEdge = ABE_BOTTOM '設定位置在下方
End If

SHAppBarMessage ABM_SETPOS, pData
SHAppBarMessage ABM_ACTIVATE, pData
DoEvents

Me.Top = pData.rc.Top * Screen.TwipsPerPixelY
Me.Left = pData.rc.Left * Screen.TwipsPerPixelX

End Sub

Private Sub Form_Load()
pData.cbSize = Len(pData)
pData.hwnd = Me.hwnd
pData.uCallbackMessage = 123
SHAppBarMessage ABM_NEW, pData
Command1(0).Caption = "Left"
Command1(1).Caption = "Top"
Command1(2).Caption = "Right"
Command1(3).Caption = "Bottom"

End Sub

Private Sub Form_Terminate()
SHAppBarMessage ABM_REMOVE, pData
End Sub
回复
wenlz 2003-01-09
谢谢楼上的,我虽然不太懂,但还算是有了点认识。就是不知道哪里有比较详细的API函数的说明可以下载
回复
AechoJohn 2003-01-09
这是一个网站上的东西,你看看吧,再对应一下Msdn

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: KPDTeam@Allapi.net
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基础类
创建于2007-09-28

7451

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告