不错,记得我曾写了迅雷开放引擎au3的例子,有人发扬光大呀
非常好的事。
#include <Memory.au3>
TrayIconToggle(0)
Func TrayIconToggle($iToggle)
Local Const $tag = "int Bitmap;int Command;byte State;byte Style;align;dword_ptr Param;int_ptr String"
Local $hTray, $hToolbar, $iCount, $sText, $iCmd
Local $tButton, $iBuffer, $iSize, $tMemMap, $pMemMap
$hTray = WinGetHandle("[CLASS:Shell_TrayWnd]")
$hToolbar = ControlGetHandle($hTray, "", "[CLASSNN:ToolbarWindow321]")
$iCount = _SendMessage($hToolbar, 1048)
For $i = 0 To $iCount - 1
$tButton = DllStructCreate($tag)
$iSize = DllStructGetSize($tButton)
$pMemMap = _MemInit($hToolbar, $iSize, $tMemMap)
_MemWrite($tMemMap, $tButton, $pMemMap, $iSize)
_SendMessage($hToolbar, 1047, $i, $pMemMap, 0, "wparam", "ptr")
_MemRead($tMemMap, $pMemMap, $tButton, $iSize)
_MemFree($tMemMap)
$iCmd = DllStructGetData($tButton, "Command")
$iBuffer = (_SendMessage($hToolbar, 1099, $iCmd) + 1) * 2
$tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
$pMemMap = _MemInit($hToolbar, $iBuffer, $tMemMap)
_SendMessage($hToolbar, 1099, $iCmd, $pMemMap, 0, "wparam", "ptr")
_MemRead($tMemMap, $pMemMap, $tBuffer, $iBuffer)
_MemFree($tMemMap)
$sText = DllStructGetData($tBuffer, "Text")
If StringInStr($sText, "迅雷下载开放引擎") Then ExitLoop
Next
If $iToggle Then
_SendMessage($hToolbar, 1041, $iCmd, 8)
Else
_SendMessage($hToolbar, 1041, $iCmd, 4)
EndIf
EndFunc
|