Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Simple TrackPopupMenu

Posted on 1998-05-13
4
Medium Priority
?
314 Views
Last Modified: 2013-12-03
I have this problem : When I call TrackPopupMenu , the popup menu is displayed , but it is not "shown" , I mean it shows only something like a simple vertical Bar . I can see that it captures the mouse messages , and when I select a popup menu ( inside the menu ) , it is activated correctly

Any help ? Thanks
0
Comment
Question by:WxW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1401505
Are there items in the menu?  It might be that it is displaying a menu with zero menu items.  Can you use GetMenuItemCount() to confirm that there are menu items?
0
 
LVL 6

Author Comment

by:WxW
ID: 1401506
Sure there are items , because this menu is taken by LoadMenu from a resource , and anyway , I CAN select and execute the menu commands , I just can't see them ! Think that there is a bar , about the half size of a scroll bar .
0
 
LVL 11

Accepted Solution

by:
alexo earned 90 total points
ID: 1401507
The menu has to be a popup submenu.

Given that:

    hwnd = the window handle
    hinst = the application instance
    hmenu = LoadMenu(hinst, MAKEINTRESOURCE(IDR_MENU)) or similar

Here's a code that works for me:

    GetCursorPos(&pos);
    SetForegroundWindow(hwnd);
    TrackPopupMenuEx(GetSubMenu(hmenu), TPM_HORIZONTAL, pos.x, pos.y, hwnd, NULL);
    PostMessage(hwnd, WM_NULL, 0, 0);

And the menu is:

    IDR_MENU MENU DISCARDABLE
    BEGIN
        POPUP "Menu"
        BEGIN
            MENUITEM "About",                       IDM_ABOUT
            MENUITEM SEPARATOR
            MENUITEM "Exit",                        IDM_EXIT
        END
    END

0
 
LVL 6

Author Comment

by:WxW
ID: 1401508
Yes thanks alexo , that was the problem . I was trying not to use a submenu , but rather a menu from a resource .
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question