Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

GetMenuItemInfo problem

Posted on 1998-06-24
4
Medium Priority
?
701 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 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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.
Suggested Courses

877 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