Unfortunately we lost some posts in this thread from LinearSpoon, Lexikos, HotkeyIt explaining the structure build up and padding and stuff I can't speak to personally, but here are the two versions cleaned up with their help:
Code: Select all
NotifyIconGetRect(Left, Top, Right, Bottom)
SplitPath, A_AhkPath, , ,, A_AhkPath_
MsgBox,,%A_AhkPath_%, % "Left " . Left . " Top " . Top
. " Right " . Right . " Bottom " . Bottom
NotifyIconGetRect(ByRef Left, ByRef Top, ByRef Right, ByRef Bottom)
{
cbSize := A_PtrSize*3 + 16
VarSetCapacity( NII,cbSize,0 )
NumPut( cbSize, NII, 0, "uint" )
NumPut( A_ScriptHwnd, NII, A_PtrSize, "ptr" )
NumPut( 1028, NII, A_PtrSize*2, "uint" )
VarSetCapacity(Rect,16)
If DllCall( "shell32\Shell_NotifyIconGetRect", UInt,&NII, UInt,&Rect )
Return 0
Left := NumGet(Rect, 0, "Int")
Top := NumGet(Rect, 4, "Int")
Right := NumGet(Rect, 8, "Int")
Bottom := NumGet(Rect, 12,"Int")
Return 1
}
and the _Struct dependent version:
Code: Select all
#Include <_Struct>
_GUID:="ulong Data1;ushort Data2;ushort Data3;uchar Data4[8]"
_NOTIFYICONIDENTIFIER:="DWORD cbSize,HWND hWnd,UINT uID,_GUID guid"
NII := new _Struct(_NOTIFYICONIDENTIFIER, {cbSize:sizeof(_NOTIFYICONIDENTIFIER), hWnd:A_ScriptHwnd,uID:1028})
rc := new _Struct("UInt left,UInt top,UInt right,UInt bottom")
DllCall("shell32\Shell_NotifyIconGetRect", "Ptr", NII[], "PTR", rc[])
MsgBox % "Left " . rc.left . " Top " . rc.top
. " Right " . rc.right . " Bottom " . rc.bottom
Thanks for all the help...
-gwarble