Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

PostMessage value - show tray menu?



  • Please log in to reply
8 replies to this topic
nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
I know there are 'magic' numbers AutoHotkey uses for Suspend and Pause, what about showing the tray menu? As in Menu, Tray, Show...

No luck with winspector spy yet.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010

If I am understanding your question correctly, try to look at the

Menu, MenuName, Cmd [, P3, P4, P5]

command that is in AutoHotkey.


Definitely not understanding my question. wink.png 
To pause a separate script, you can send it a postmessage:
PostMessage, 0x111, 65305,,, Script's File Name.ahk

How about telling it to show its tray menu?

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
might search for and download Winspector Spy's
learn more here

also look at
[*:xlwwvp63]How to Hook on to Shell to receive its messages ? [*:xlwwvp63]Find WM_COMMAND parameter with Winspector
Never lose.
WIN or LEARN.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010

might search for and download Winspector Spy's

No luck with winspector spy yet.

So far, I have this, but it's not working:
#NoEnv
SetTitleMatchMode 2
Name = ztest.ahk

p::
   ; WM_EnterMenuLoop
   SendMessage, 0x0211, 0x00000001,0x00000000,,%Name%

   ; WM_INITMENU
   SendMessage, 0x0116, 0x00f2050f,0x00000000,,%Name%
   
   ; WM_INITMENUPOPUP
   SendMessage, 0x0117, 0x00f2050f,0x00000000,,%Name%

   ; 0x00000093
   SendMessage, 0x00000093, 0x00000000, 0x0088fab8,,%Name%
return
Another problem is getting the wparam, as it changes per script and (I think) per run.

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006
I had to go to the source to find this...
Menu, Tray, Add, So you know it's real, DoNothing
DetectHiddenWindows, on
WinExist( "AHK_Pid " DllCall("GetCurrentProcessId") ) ; make this script's main window the last found window
WinActivate ; even though it's hidden, the target script's main window must be active for the menu to open
SendMessage, 0x404, 0, 0x205 ; AHK_NOTIFYICON = 0x404, WM_RBUTTONUP = 0x205
exitapp
DoNothing:
And before you ask, the menu will only appear at the cursor position.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
aha! I can't test right now, but it looks promising. I realize that the "indirect" way of telling it there was a right click works better than the "direct" way of reproducing the messages found when it is shown. Thanks!

P.S. _L or basic source code? Which .cpp file? Or was it in one of the headers?

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
✓  Best Answer
Menu, Tray, Add, So you know it's real, DoNothing 
DetectHiddenWindows, on 
SendMessage, 0x404, 0, 0x205,,%A_ScriptFullPath% ; AHK_NOTIFYICON = 0x404, WM_RBUTTONUP = 0x205
;The title of the hidden window starts with the script's full path
DoNothing:
This seems to work without the DllCall or the WinActivate

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006
@nimda, in the AHK basic source code, look in script2.cpp for the MainWindowProc function definition.


heh, I guess it isn't necessary to activate the window... it seemed like it was when I was futzing around with the code.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Well there's the problem. I was looking in script_menu.cpp
Thanks for finding it!