Windows, C Language, Menu Resizing

Thread Starter

MrAl

Joined Jun 17, 2014
11,480
Hello there,

I had meant to get back to this problem for a number of years now.

I am using the SetMenuItemInfo function in the Windows API along with a MENUITEMINFO struct to set the text for a floating pop up context menu.

This works fine unless the menu is later modified with a text string that is shorter than it was before. For example, if i have three strings in the menu:
File
GotoA
Exit

and then modify the second item in the menu later to:
File
GoToABCDEFGHIHKLMNOP
Exit

the menu width automatically adjusts to that longer string now and it looks fine.
However, if i later modify it for example back to:
File
GoToA
Exit

the menu width does not adjust back to the original width, it keeps the much wider width caused by the much wider string used before this.

What i would like it to do is adjust back to the original width.

What i dont want to have to do is destroy the whole menu and then rebuild the whole thing, which is one solution i believe. The menu can be big so i wanted to avoid this if possible.

Any ideas?
 
Top