user32: Don't truncate bitmap ids in InsertMenu.

This commit is contained in:
Alexandre Julliard 2011-06-21 16:07:00 +02:00
parent 6b0d9ff1cd
commit 33ba7c07fb
2 changed files with 14 additions and 1 deletions

View File

@ -3816,7 +3816,7 @@ static void MENU_mnu2mnuii( UINT flags, UINT_PTR id, LPCWSTR str,
pmii->dwTypeData = (LPWSTR)str;
} else if( flags & MFT_BITMAP){
pmii->fMask |= MIIM_BITMAP | MIIM_STRING;
pmii->hbmpItem = ULongToHandle(LOWORD(str));
pmii->hbmpItem = (HBITMAP)str;
}
if( flags & MF_OWNERDRAW){
pmii->fMask |= MIIM_DATA;

View File

@ -404,6 +404,7 @@ static void test_menu_ownerdraw(void)
int i,j,k;
BOOL ret;
HMENU hmenu;
MENUITEMINFO mii;
LONG leftcol;
HWND hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
@ -463,6 +464,18 @@ static void test_menu_ownerdraw(void)
"Height is incorrect. Got %d expected %d\n",
MOD_rc[0].bottom - MOD_rc[0].top, MOD_SIZE);
/* test owner-drawn callback bitmap */
ModifyMenu( hmenu, 1, MF_BYPOSITION | MFT_BITMAP, 1, (LPCSTR)HBMMENU_CALLBACK );
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_BITMAP | MIIM_FTYPE | MIIM_ID;
if (GetMenuItemInfoA( hmenu, 1, TRUE, &mii ))
{
ok( mii.fType == MFT_BITMAP, "wrong type %x\n", mii.fType );
ok( mii.wID == 1, "wrong id %x\n", mii.wID );
ok( mii.hbmpItem == HBMMENU_CALLBACK, "wrong data %p\n", mii.hbmpItem );
}
TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
/* test width/height of an ownerdraw menu bar as well */
ret = DestroyMenu(hmenu);
ok(ret, "DestroyMenu failed with error %d\n", GetLastError());