MenuItemFromPoint shouldn't crash if there's no menu.

This commit is contained in:
Richard Cohen 2004-09-24 00:22:13 +00:00 committed by Alexandre Julliard
parent 48dc31640d
commit 52373b2df3
2 changed files with 5 additions and 6 deletions

View File

@ -633,7 +633,7 @@ static void MENU_FreeItemData( MENUITEM* item )
* not work for child windows and therefore should not be called for
* an arbitrary system menu.
*/
static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu,
static MENUITEM *MENU_FindItemByCoords( const POPUPMENU *menu,
POINT pt, UINT *pos )
{
MENUITEM *item;
@ -4500,15 +4500,14 @@ DWORD WINAPI GetMenuContextHelpId( HMENU hMenu )
/**********************************************************************
* MenuItemFromPoint (USER32.@)
*/
UINT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen)
INT WINAPI MenuItemFromPoint(HWND hWnd, HMENU hMenu, POINT ptScreen)
{
POPUPMENU *menu = MENU_GetMenu(hMenu);
UINT pos;
MENUITEM *item;
/*FIXME: Do we have to handle hWnd here? */
item = MENU_FindItemByCoords(menu, ptScreen, &pos);
if (!menu) return -1;
if (!MENU_FindItemByCoords(menu, ptScreen, &pos)) return -1;
return pos;
}

View File

@ -4336,7 +4336,7 @@ UINT WINAPI MapVirtualKeyExW(UINT,UINT,HKL);
#define MapVirtualKeyEx WINELIB_NAME_AW(MapVirtualKeyEx)
BOOL WINAPI MapDialogRect(HWND,LPRECT);
INT WINAPI MapWindowPoints(HWND,HWND,LPPOINT,UINT);
UINT WINAPI MenuItemFromPoint(HWND,HMENU,POINT);
INT WINAPI MenuItemFromPoint(HWND,HMENU,POINT);
BOOL WINAPI MessageBeep(UINT);
INT WINAPI MessageBoxA(HWND,LPCSTR,LPCSTR,UINT);
INT WINAPI MessageBoxW(HWND,LPCWSTR,LPCWSTR,UINT);