Page 1 of 1

How to intercept the tray menu?

Posted: 27 Apr 2019, 10:48
by arcticir
Right click on the tray icon to execute the command directly instead of displaying the menu. Excuse me, how to achieve(V2)?

Re: How to intercept the tray menu?

Posted: 27 Apr 2019, 11:44
by JoeWinograd
I like to give credit where credit is due, but I don't know who wrote this code. I do know that it's from this group...that I didn't write it...and that it works perfectly:

Code: Select all

Menu,Tray,NoStandard
OnMessage(0x404,"AHK_NOTIFYICON")
AHK_NOTIFYICON(wParam,lParam)
{
  If (lParam=0x201) ; WM_LBUTTONDOWN
  {
    ; left-click code here
    MsgBox left-click code here
  }
  If (lParam=0x204) ; WM_RBUTTONDOWN
  {
    ; right-click code here
    MsgBox right-click code here
  }
  Return
}
My thanks to the member who wrote the code...and apologies for not being to acknowledge who you are. Regards, Joe

Re: How to intercept the tray menu?

Posted: 27 Apr 2019, 15:47
by arcticir
Thank you. This is exactly what I need. ;)

Re: How to intercept the tray menu?

Posted: 27 Apr 2019, 16:26
by JoeWinograd
You're welcome. Glad to hear that's what you need. Regards, Joe