Popup menu as a response to a click on an icon the context area

This is a discussion on Popup menu as a response to a click on an icon the context area within the Windows Programming forums, part of the Platform Specific Boards category; I put an icon in the notification area using Shell_NotifyIcon and specified a window (that receives notification messages from this ...

  1. #1
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96

    Popup menu as a response to a click on an icon the context area

    I put an icon in the notification area using Shell_NotifyIcon and specified a window (that receives notification messages from this icon) and a user message (that is sent in such cases) in the NOTIFYICONDATA structure. It works correctly, as a response to a right click on the icon, this user message is sent. The wParam is an id of the icon and lParam is the message (e.g. WM_RBUTTONDOWN). If I want, let's say, to close the app on a right click, I can. Problem is, that I want a popup menu to be displayed and need the x and y coordinates for TrackPopupMenuEx(). How can I obtain them when wParam and lParam are used as mentioned above?

    I tried using GetMouseMovePointsEx to get actual mouse cursor coordinates, but this code:
    Code:
    MOUSEMOVEPOINT mmp_out = {0}, mmp_in = {0};
    int i = ::GetMouseMovePointsEx(	sizeof MOUSEMOVEPOINT, mmp_in, mmp_out, 1, GMMP_USE_DISPLAY_POINTS);
    always returns i == -1.
    Please excuse my poor english...

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I use GetCursorPos().

    GetMouseMovePointEx() second and third parameters should be pointers to MOUSEMOVEPOINT structures. That's probably what your code is complaining about. If in doubt when an API function fails, call GetLastError() and find out why it failed.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96
    As for the parameters, I misspelled them, it should be &mm_in and &mm_out.

    GetLastError() returns GMMP_ERR_POINT_NOT_FOUND "The point specified by lppt could not be found or is no longer in the system buffer."

    So even though the function is described as "The GetMouseMovePointsEx function retrieves a history of up to 64 previous coordinates of the mouse or pen", I haven't found the way to do it.

    But GetCursorPos() seems to be working fine, thanks.
    Please excuse my poor english...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do I add buttons near the menu area.
    By vopo in forum Windows Programming
    Replies: 3
    Last Post: 10-13-2007, 02:39 AM
  2. Image on the menu bar unused area ?
    By hemanth.balaji in forum Windows Programming
    Replies: 2
    Last Post: 06-05-2005, 12:40 PM
  3. Problem with an icon in the TaskBar status area
    By dit6a9 in forum Windows Programming
    Replies: 2
    Last Post: 08-16-2004, 11:33 PM
  4. Double click for context menu?
    By mepaco in forum Windows Programming
    Replies: 1
    Last Post: 12-19-2002, 06:17 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21