Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

GetMenuItemInfo problem

Posted on 1998-06-24
4
Medium Priority
?
694 Views
Last Modified: 2008-02-01
Hi all!

I am going to build a "Bookmark" type menu in my application
and I need to retrieve the Content of a Popup menu item in order
to look it up in my bookmark-table.

I am trying to use the function GetMenuItemInfo when the
WM_INITPOPUPMENU message is generated because,
as far as I see, this is the only way to retrieve the content of
a popupmenu (?). Is there another way?

I am initialising the call with the correct handle and index so
I suspect it is my MENUITEMINFO structure that is incorrect.

I am receiving an error of 87 (decimal) when I use the GetLastError
after the GetMenuItemInfo call fails.

Does anybody have any sample code that makes use of
this call? Or do you have any other ideas of how to solve
my problem?

Best rgds, Anders Karlsson
0
Comment
Question by:Kalle 2
[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
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 400 total points
ID: 1166565
You probably don't set the cbSize member of the MENUITMEINFO structure.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1166566
Before you call GetMenuItemInfo() you must initialize the cbSize member to the size of the MENUITEMINFO structure.  This is bacause windows is allowing for the size fo the structure to change in the future. GetMenuItemInfo() uses the size to tell what version of the structure you are passing.  

Try the following

MENUITMEINFO MenuItemInfo;
MenuItemInfo.cbSize = sizeof(MENUITEMINFO);

GetMenuItem();
0
 
LVL 22

Expert Comment

by:nietod
ID: 1166567
If that is not the problem, can you post your code?
0
 

Author Comment

by:Kalle 2
ID: 1166568
Thanks! // Anders
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

670 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