http://bugs.winehq.org/show_bug.cgi?id=4004
Summary: InsertMenuItem, GetMenuString fails with MFT_OWNERDRAW Product: Wine Version: 0.9.1. Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P4 Component: wine-gui AssignedTo: wine-bugs@winehq.org ReportedBy: andrew7webb@comcast.net
A Menu item containing a string, which is also owner drawn cannot be retrieved with GetMenuString.
A very short C program (attached) will work on windows but fail on wine.
The crucial code is:
MENUITEMINFO mii; mii.fMask= MIIM_FTYPE | MIIM_STRING; mii.fType= MFT_OWNERDRAW; ... if ( InsertMenuItem( hMenu, uItem, fByPosition, &mii ) ) { if ( GetMenuString( hMenu, uItem, strback, 99, MF_BYPOSITION ) ) { MessageBox( 0, "GetMenuString worked.", strback, MB_OK ); } else { MessageBox( 0, "GetMenuString failed.", title, MB_OK ); }
GetMenuString will fail on wine, but succeed on windows.
After examining the problem , it appears that the relevant source code is the function SetMenuItemInfo_common, the function GetMenuStringA, and the macro IS_STRING_ITEM in user/menu.c The concept of having a string and the MF_OWNERDRAW specified seems to cause trouble in the macro.