Fixed copying of the MDI 'Windows' menu items if the items are not of
type MFT_STRING.
This commit is contained in:
parent
2d6eabacc3
commit
738c06d945
|
@ -249,20 +249,30 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
|
|||
if( ci->nActiveChildren )
|
||||
{
|
||||
INT j = i - ci->nActiveChildren + 1;
|
||||
char buffer[100];
|
||||
UINT id,state;
|
||||
LPWSTR buffer = NULL;
|
||||
MENUITEMINFOW mii;
|
||||
|
||||
for( ; i >= j ; i-- )
|
||||
{
|
||||
id = GetMenuItemID(ci->hWindowMenu,i );
|
||||
state = GetMenuState(ci->hWindowMenu,i,MF_BYPOSITION);
|
||||
|
||||
GetMenuStringA(ci->hWindowMenu, i, buffer, 100, MF_BYPOSITION);
|
||||
memset(&mii, 0, sizeof(mii));
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE
|
||||
| MIIM_SUBMENU | MIIM_TYPE | MIIM_BITMAP;
|
||||
|
||||
GetMenuItemInfoW(ci->hWindowMenu, i, TRUE, &mii);
|
||||
if(mii.cch) { /* Menu is MFT_STRING */
|
||||
mii.cch++; /* add room for '\0' */
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0,
|
||||
mii.cch * sizeof(WCHAR));
|
||||
mii.dwTypeData = buffer;
|
||||
GetMenuItemInfoW(ci->hWindowMenu, i, TRUE, &mii);
|
||||
}
|
||||
DeleteMenu(ci->hWindowMenu, i, MF_BYPOSITION);
|
||||
InsertMenuA(hmenuWindow, pos, MF_BYPOSITION | MF_STRING,
|
||||
id, buffer);
|
||||
CheckMenuItem(hmenuWindow ,pos , MF_BYPOSITION | (state & MF_CHECKED));
|
||||
InsertMenuItemW(hmenuWindow, pos, TRUE, &mii);
|
||||
if(buffer) {
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue