[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Measure a Popup menu

Posted on 1998-12-06
2
Medium Priority
?
503 Views
Last Modified: 2013-11-20
I am trying to measure the width and height of my Popup
menu. I am trying the following code, but with no success.
It does not give me an error but the values of Width
and Height are wrong.

void CPopUpMenuView::OnContextMenu(CWnd* pWnd, CPoint point)
{
      // TODO: Add your message handler code here
      CMenu menu;
      menu.LoadMenu(IDR_MENU1);
      menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|
            TPM_RIGHTBUTTON, point.x, point.y, this);

      MEASUREITEMSTRUCT lpMeasureItemStruct;
      menu.MeasureItem(&lpMeasureItemStruct );
      UINT Width = lpMeasureItemStruct.itemWidth;
      UINT Height = lpMeasureItemStruct.itemHeight;
}
Any ideas?

0
Comment
Question by:Malek103197
[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 Comments
 
LVL 2

Accepted Solution

by:
wyy_cq earned 100 total points
ID: 1325800
you can caculate the with from the string width,
and get the height from the system metrics.

Called by the framework when a menu with the owner-draw style is created. By default, this member function does nothing. Override this member function and fill in the MEASUREITEMSTRUCT structure to inform Windows of the menu's dimensions.


0
 

Author Comment

by:Malek103197
ID: 1325801
Thanks for your answer wyy_cq, but I need a little more guidence than you've provided. You state: "you can caculate the width from the string width, and get the height from the system metrics.". How do I calculate the string width of the Popup menu and can you give me more info on using the system metrics. Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Invest in your employees with these five simple steps to improve employee engagement and retention.
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

649 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