Jump to content
Sign in to follow this  

Need help on SHAppBarMessage

Recommended Posts


I want to register a windows as an appbar,and I found that I can use SHAppBarMessage function by sending ABM_NEW message to do it.

In MSDN it says:

You must specify the cbSize, hWnd, and uCallbackMessage members when sending this message

but I don't know how to specify the "uCallbackMessage",what should I do?

here is what I got so far:


Global Const $ABM_ACTIVATE      = 0x06
Global Const $ABM_GETAUTOHIDEBAR     = 0x07
Global Const $ABM_GETSTATE      = 0x04
Global Const $ABM_SETSTATE      = 0x0000000a
Global Const $ABM_GETTASKBARPOS  = 0x05
Global Const $ABM_NEW        = 0x00
Global Const $ABM_QUERYPOS      = 0x02
Global Const $ABM_REMOVE  = 0x01
Global Const $ABM_SETAUTOHIDEBAR = 0x08
Global Const $ABM_SETPOS  = 0x03
Global Const $ABM_WINDOWPOSCHANGED   = 0x09
Global Const $ABS_ALWAYSONTOP = 0x2
Global Const $ABS_AUTOHIDE = 0x1
Global Const $ABE_LEFT = 0
Global Const $ABE_TOP = 1
Global Const $ABE_RIGHT = 2
Global Const $ABE_BOTTOM = 3


Func SHAppBarMessage($Message,ByRef $pabd)
    $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$Message,"ptr",DllStructGetPtr($pabd))
    If Not @error Then
        If $lResult[0] Then
            Return $lResult[0]
    Return False


Dim $handle = Wingethandle("Notepad - untitled")
Dim $uCallbackMessage
$pabd = DllStructCreate("dword;int;uint;uint;int;int;int;int;int")
DllStructSetData($pabd,1,DllStructGetSize($pabd)) ;cbSize
DllStructSetData($pabd,2,$handle) ;hWnd
DllStructSetData($pabd,3,$uCallbackMessage) ;uCallbackMessage


Edited by zhao

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this