In Listing 6.3, the first thing that you did was make a copy of the mouse position. This
mouse position is a relative position within the window area. It must be converted to an
absolute position on the entire screen area for displaying the pop-up menu. If you don’t
convert the position coordinates, you can’t predict where your pop-up menu will appear.
After you convert the position to an absolute position, you get a pointer to the window
menu. This pointer should always be a local pointer within the function where you are
going to use it because the location of the menu might change as the application runs.
From the menu pointer, you next get a pointer to the first drop-down menu (submenu
numbering begins with 0, like just about everything else in C/C++). After you have a
pointer to the submenu, you can treat it as a regular CMenu class instance.
The final piece in this puzzle is the call to the CMenu member function TrackPopupMenu.
This function takes five arguments and uses them to determine where and how to show