Trouble with systray menu

This is a discussion on Trouble with systray menu within the Windows Programming forums, part of the Platform Specific Boards category; Hi, Iíve set an icon on the systray and iím trying to make appear a popup menu when i right ...

  1. #1
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    375

    Trouble with systray menu

    Hi,

    Iíve set an icon on the systray and iím trying to make appear a popup menu when i right click the icon, with TrackPopupMenu().

    Code:
    menu = LoadMenu(hInstancegl,MAKEINTRESOURCE(IDSTMENU)); SetForegroundWindow(hWndDlg);
    TrackPopupMenu(menu,TPM_CENTERALIGN|TPM_VCENTERALIGN|TPM_RETURNCMD|
              TPM_RIGHTBUTTON,GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam),0,hWndDlg,NULL);
    But the menu (whichís got 2 items) wonít appear correctly. When i right click on the icon, what appears is only a weird thin vertical line at the top of the screen. For the menu, iíve selected "view as popup" option. Any suggestions please?

    Thanks.
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    I think you're using the x and y co-ordinates in the icon that was clicked. Try ClientToScreen() to convert the them the screen co-ordinates.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Code:
                GetCursorPos(&Pos);
                SetForegroundWindow(hWnd);
                TrackPopupMenuEx(hMenu,
                                 TPM_BOTTOMALIGN,
                                 Pos.x,
                                 Pos.y,
                                 hWnd,
                                 NULL);
    Where Pos is declard as a POINT.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    375
    Thanks, it solved the coordinates problem.
    And I also have that "menu's not displaying properly" problem. In the menu editor, the menu seems fine. But when i run the program, the menu turns into just a thin line?
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Systray menu messages
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 05-09-2005, 06:25 AM
  5. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM

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