Solved

GetMenuItemInfo problem

Posted on 1998-06-24
4
665 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
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now