Solved

GetMenuItemInfo problem

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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. …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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.
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.

623 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