trace back menu selection

I have installed a WH_GETMESSAGE hook, and when a user clicks on a menu in
another application, I'd like to trace back the menu item he/she clicked on.
For example, if the user selects the item "Event Log" in Delphi 5, I'd like
to be able to trace that selection back to it's origin like: "View->Debug
Windows->Event Log".

I have tried to do this in a recursive procedure, but I think this is not
the way, because I need to know the starting point for the search. In most
cases that would be GetMenu(handle of window), but not in the case of pop-up