krychu has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'd like to capture all user menu selections in a particular application. The menu items can be invoked either using cascading menu, context menu or keyboard shortcut. I'd like to know which command was invoked, when, and preferably also get its depth in the menu command structure. Therefore, I need to capture another application's events. What would be the way to do it? Best Regards, Krychu

Replies are listed 'Best First'.
Re: Tracking application events in Windows
by larryk (Friar) on Oct 02, 2008 at 16:49 UTC
    The best way is to define a new standard for application monitoring, sell it to the companies you are interested in and get them to call your API. On the off-chance that you don't get buy-in, you could resort to some sort of nastiness with SetWindowsHookEx but I don't fancy your chances in Perl (e.g. using Win32::API) so the next best way is to write a little event logger in C and tail the log from Perl. This will work assuming those apps aren't actively protecting their message queues. Check out the WH_GETMESSAGE and GetMsgProc handler documentation on MSDN.
       larryk                                          
    perl -le "s,,reverse killer,e,y,rifle,lycra,,print"
    
Re: Tracking application events in Windows
by perreal (Monk) on Oct 02, 2008 at 16:22 UTC
    Which operating system, what kind of applications are you interested in?
      MS Windows XP. The applications are: 3ds max, Maya, Photoshop and Eclipse
Re: Tracking application events in Windows
by Anonymous Monk on Oct 03, 2008 at 05:49 UTC