Commit 33ba7c07 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Don't truncate bitmap ids in InsertMenu.

parent 6b0d9ff1
...@@ -3816,7 +3816,7 @@ static void MENU_mnu2mnuii( UINT flags, UINT_PTR id, LPCWSTR str, ...@@ -3816,7 +3816,7 @@ static void MENU_mnu2mnuii( UINT flags, UINT_PTR id, LPCWSTR str,
pmii->dwTypeData = (LPWSTR)str; pmii->dwTypeData = (LPWSTR)str;
} else if( flags & MFT_BITMAP){ } else if( flags & MFT_BITMAP){
pmii->fMask |= MIIM_BITMAP | MIIM_STRING; pmii->fMask |= MIIM_BITMAP | MIIM_STRING;
pmii->hbmpItem = ULongToHandle(LOWORD(str)); pmii->hbmpItem = (HBITMAP)str;
} }
if( flags & MF_OWNERDRAW){ if( flags & MF_OWNERDRAW){
pmii->fMask |= MIIM_DATA; pmii->fMask |= MIIM_DATA;
......
...@@ -404,6 +404,7 @@ static void test_menu_ownerdraw(void) ...@@ -404,6 +404,7 @@ static void test_menu_ownerdraw(void)
int i,j,k; int i,j,k;
BOOL ret; BOOL ret;
HMENU hmenu; HMENU hmenu;
MENUITEMINFO mii;
LONG leftcol; LONG leftcol;
HWND hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL, HWND hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
...@@ -463,6 +464,18 @@ static void test_menu_ownerdraw(void) ...@@ -463,6 +464,18 @@ static void test_menu_ownerdraw(void)
"Height is incorrect. Got %d expected %d\n", "Height is incorrect. Got %d expected %d\n",
MOD_rc[0].bottom - MOD_rc[0].top, MOD_SIZE); 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 */ /* test width/height of an ownerdraw menu bar as well */
ret = DestroyMenu(hmenu); ret = DestroyMenu(hmenu);
ok(ret, "DestroyMenu failed with error %d\n", GetLastError()); ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment