Thread: Trouble with systray menu

  1. #1
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470

    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.
    GameJolt: https://gamejolt.com/@KasunL
    Game Development Youtube:
    https://is.gd/XyhYoP
    Amateur IT Blog: http://everything-geeky.blogspot.com/



    (and, sorry for my amateur 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,829
    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 geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470
    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?
    GameJolt: https://gamejolt.com/@KasunL
    Game Development Youtube:
    https://is.gd/XyhYoP
    Amateur IT Blog: http://everything-geeky.blogspot.com/



    (and, sorry for my amateur 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, 10: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