本帖最后由 kinghu318 于 2011-4-22 11:05 编辑
通过TrayCreateItem 创建托盘菜单有什么办法可以设置图标,ModernMenuRaw.au3通过这个可以设置,但是不能左键双击显示界面,有没有什么可行的办法,看了一下午的ModernMenuRaw.au3没发现什么方法。。。。请求高人帮忙,谢谢。。。
终于找到了通过判断事件来调用ModernMenuRaw.au3 的_TrayNotifyIcon方法Func _TrayNotifyIcon($hWnd, $Msg, $wParam, $lParam)
Local $nClick = 0
Local $nID = $wParam
If $TRAYNOTIFYIDS[$nID][5] <> "" And _
($TRAYNOTIFYIDS[$nID][6] = 0 Or _
$TRAYNOTIFYIDS[$nID][6] = $lParam) Then
Call($TRAYNOTIFYIDS[$nID][5], $nID, $lParam)
EndIf
Switch $lParam
Case $WM_LBUTTONDOWN
$nClick = 1
case $WM_LBUTTONUP
$nClick = 2
case $WM_LBUTTONDBLCLK
$nClick = 4
case $WM_RBUTTONDOWN
$nClick = 8
case $WM_RBUTTONUP
$nClick = 16
case $WM_RBUTTONDBLCLK
$nClick = 32
case $WM_MOUSEMOVE
$nClick = 64
EndSwitch
;If BitAnd($nClick, $TRAYNOTIFYIDS[$nID][3]) And $TRAYNOTIFYIDS[$nID][2] > 0 Then 这里需要注销,如果要使用两个事件的话
If $nClick=16 Then;判断事件
Local $hMenu = GUICtrlGetHandle($TRAYNOTIFYIDS[$nID][2])
If $hMenu <> 0 Then
Local $stPoint = DllStructCreate("int;int")
GetCursorPos(DllStructGetPtr($stPoint))
SetForegroundWindow($hWnd)
TrackPopupMenuEx($hMenu, 0, DllStructGetData($stPoint, 1), DllStructGetData($stPoint, 2), $hWnd, 0)
PostMessage($hWnd, 0, 0, 0)
EndIf
ElseIf $nClick=2 Then
GUISetState(@SW_SHOW)
EndIf
;EndIf
EndFunc
|