Solved

GetMenuItemInfo problem

Posted on 1998-06-24
4
678 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 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

Independent Software Vendors: 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

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

738 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