コード例 #1
0
BOOL wbIsWBObj(void *pwbo, BOOL bShowErrors)
{
	if(!pwbo) {
		if(bShowErrors)
			wbError(__FUNCTION__, MB_ICONWARNING, "NULL WinBinder object");
		return FALSE;
	}

	// Is pwbo a valid memory address?

	if(IsBadReadPtr(pwbo, sizeof(WBOBJ))) {
		if(bShowErrors)
			wbError(__FUNCTION__, MB_ICONWARNING, "Invalid memory address");
//		printf("%d\n", pwbo);
		return FALSE;
	}

	// A Windows or menu handle is not a WinBinder object

	if(IsWindow(pwbo) || IsMenu(pwbo)) {
		if(bShowErrors)
			wbError(__FUNCTION__, MB_ICONWARNING, "Not a WinBinder object");
		return FALSE;
	}

	// Does it have a valid handle?

	{
		PWBOBJ pwboTest = wbMalloc(sizeof(WBOBJ));
		if(pwboTest) {
			CopyMemory(pwboTest, pwbo, sizeof(WBOBJ));

			if(!pwboTest->hwnd) {
				wbFree(pwboTest);
				if(bShowErrors)
					wbError(__FUNCTION__, MB_ICONWARNING, "NULL WinBinder object handle");
				return FALSE;
			}
			wbFree(pwboTest);
		}
	}

	if(IsMenu((HMENU)((PWBOBJ)pwbo)->hwnd))
		return TRUE;

	if(IsWindow((HWND)((PWBOBJ)pwbo)->hwnd))
		return TRUE;

	if(bShowErrors)
		wbError(__FUNCTION__, MB_ICONWARNING, "Invalid WinBinder object");

	return FALSE;
}
コード例 #2
0
ファイル: VMouseDlg.cpp プロジェクト: wisaly/VirtualMouse
void CVMouseDlg::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
	if(lpMeasureItemStruct->CtlType == ODT_MENU)
	{
		if(IsMenu((HMENU)lpMeasureItemStruct->itemID) 
			&& IsMenu((HMENU)lpMeasureItemStruct->itemID))
		{
			m_trayIcon.m_menu.MeasureItem(lpMeasureItemStruct);
		}
	}
	CDialog::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
}
コード例 #3
0
ファイル: olemisc.cpp プロジェクト: Rupan/winscp
void AFXAPI AfxUnmergeMenus(HMENU hMenuShared, HMENU hMenuSource,
	HMENU hHelpMenuPopup /* = NULL */)
{
	ASSERT(hMenuShared != NULL && IsMenu(hMenuShared));
	ASSERT(hMenuSource != NULL && IsMenu(hMenuSource));
	ASSERT(hHelpMenuPopup == NULL || IsMenu(hHelpMenuPopup));

	int cOurItems = GetMenuItemCount(hMenuSource);
	int cMenuItems = GetMenuItemCount(hMenuShared);

	for (int i = cMenuItems-1; i >= 0; i--)
	{
		// check out the popup menus
		HMENU hMenuPopup = ::GetSubMenu(hMenuShared, i);
		if (hMenuPopup != NULL)
		{
			// if we have a Help submenu, check to see if it appears in this
			// submenu someplace... this normally happens only in
			// DocObject frame windows

			if (hHelpMenuPopup != NULL)
			{
				int cPopupItems = ::GetMenuItemCount(hMenuPopup);
				for (int k = 0; k < cPopupItems; k++)
				{
					if (::GetSubMenu(hMenuPopup, k) == hHelpMenuPopup)
					{
						::RemoveMenu(hMenuPopup, k, MF_BYPOSITION);
						hHelpMenuPopup = NULL;  // can only have one
						break;
					}
				}
			}
			else
			{
				// if it is one of ours, remove it from the pMenuShared
				for (int j = 0; j < cOurItems; j++)
				{
					if (::GetSubMenu(hMenuSource, j) == hMenuPopup)
					{
						// remove the menu from pMenuShared
						RemoveMenu(hMenuShared, i, MF_BYPOSITION);
						break;
					}
				}
			}
		}
	}
}
コード例 #4
0
ファイル: iupwin_menu.c プロジェクト: Archs/iup-aio
static int winSeparatorMapMethod(Ihandle* ih)
{
  int pos;
  MENUITEMINFO menuiteminfo;

  if (!ih->parent || !IsMenu((HMENU)ih->parent->handle))
    return IUP_ERROR;

  pos = IupGetChildPos(ih->parent, ih);
  ih->serial = iupMenuGetChildId(ih);

  menuiteminfo.cbSize = sizeof(MENUITEMINFO); 
  menuiteminfo.fMask = MIIM_FTYPE|MIIM_ID|MIIM_DATA; 
  menuiteminfo.fType = MFT_SEPARATOR; 
  menuiteminfo.wID = (UINT)ih->serial;
  menuiteminfo.dwItemData = (ULONG_PTR)ih; 

  if (!InsertMenuItem((HMENU)ih->parent->handle, pos, TRUE, &menuiteminfo))
    return IUP_ERROR;

  ih->handle = ih->parent->handle; /* gets the HMENU of the parent */
  winMenuUpdateBar(ih);

  return IUP_NOERROR;
}
コード例 #5
0
ファイル: nsMenuFrame.cpp プロジェクト: mmmulani/v8monkey
//
// Enter
//
// Called when the user hits the <Enter>/<Return> keys or presses the
// shortcut key. If this is a leaf item, the item's action will be executed.
// In either case, do nothing if the item is disabled.
//
nsMenuFrame*
nsMenuFrame::Enter()
{
  if (IsDisabled()) {
#ifdef XP_WIN
    // behavior on Windows - close the popup chain
    if (mMenuParent) {
      nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
      if (pm) {
        nsIFrame* popup = pm->GetTopPopup(ePopupTypeAny);
        if (popup)
          pm->HidePopup(popup->GetContent(), PR_TRUE, PR_TRUE, PR_TRUE);
      }
    }
#endif   // #ifdef XP_WIN
    // this menu item was disabled - exit
    return nsnull;
  }

  if (!IsOpen()) {
    // The enter key press applies to us.
    if (!IsMenu() && mMenuParent)
      Execute(0);          // Execute our event handler
    else
      return this;
  }

  return nsnull;
}
コード例 #6
0
ファイル: wb_control_menu.c プロジェクト: Darksynx/WinBinder
BOOL wbSetMenuItemSelected(PWBOBJ pwbo)
{
	if(!pwbo || !pwbo->hwnd || !IsMenu((HMENU)pwbo->hwnd))
		return FALSE;

	return CheckMenuRadioItem((HMENU)pwbo->hwnd, pwbo->id, pwbo->id, pwbo->id, MF_BYCOMMAND);
}
コード例 #7
0
ファイル: MENU.CPP プロジェクト: chrisoldwood/WIN16
CMenu::~CMenu(void)
{
	// Only destroy if not already. 
	// e.g. by the parent window.
	if (IsMenu(m_hMenu))
		DestroyMenu(m_hMenu);
}
コード例 #8
0
ファイル: FavMenu.cpp プロジェクト: Kerlifw/pcman-windows
void CFavMenu::LoadIEFav(HMENU &fav_menu)
{
//	錯誤,這樣會把其他favorite和history的CFavMenu <-> HMENU對應刪除
//	favmenus.RemoveAll();
//	改成下列方式,因為上面已經 DestroyMenu( fav_menu ),所以可以很投機取巧的
//	利用 IsMenu 來檢查,移除 favmenu 中已經無效的 Handles
	int i;	//	此 i 在稍後的程式還有使用
	for (i = favmenus.GetSize() - 1;i >= 0;i--)	//搜尋看是否為CFavMenu
		if (!IsMenu(reinterpret_cast<HMENU>(favmenus[i])))
			favmenus.RemoveAt(i);
	//	刪除特定位置第i個 item 後,其後的array都會往前 shift 1,
	//	但是不用管他,因為是由後往前檢查,所以i後面的都已經檢查過

	DestroyMenu(fav_menu);
	web_fav.RemoveAll();

	CString favdir = GetIEFavDir();

	max_height = GetSystemMetrics(SM_CYSCREEN) - 64;
	item_height = GetSystemMetrics(SM_CYMENU);

	UINT id = ID_FIRST_WEB_FAVORITE;
	fav_menu = CreatePopupMenu();
	AddToIEFav(fav_menu, favdir, id);
}
コード例 #9
0
ファイル: EDITHLP.C プロジェクト: thearttrooper/KappaPC
HMENU SetupKALPopupMenu()
{
    if (!IsMenu(hKALPpMainMenu))
        hKALPpMainMenu = LoadMenu(hInstDLL, MAKEINTRESOURCE(IDP_KALPOPUP));

    return hKALPpMainMenu;
}
コード例 #10
0
ファイル: iupwin_menu.c プロジェクト: Archs/iup-aio
static int winItemMapMethod(Ihandle* ih)
{
  int pos;
  MENUITEMINFO menuiteminfo;

  if (!ih->parent || !IsMenu((HMENU)ih->parent->handle))
    return IUP_ERROR;

  pos = IupGetChildPos(ih->parent, ih);
  ih->serial = iupMenuGetChildId(ih);

  menuiteminfo.cbSize = sizeof(MENUITEMINFO); 
  menuiteminfo.fMask = MIIM_ID|MIIM_DATA|MIIM_STRING; 
  menuiteminfo.dwTypeData = ""; /* must set or it will be not possible to update */
  menuiteminfo.cch = 0;
  menuiteminfo.wID = (UINT)ih->serial;
  menuiteminfo.dwItemData = (ULONG_PTR)ih; 

  if (!InsertMenuItem((HMENU)ih->parent->handle, pos, TRUE, &menuiteminfo))
    return IUP_ERROR;

  ih->handle = ih->parent->handle; /* gets the HMENU of the parent */
  winMenuUpdateBar(ih);

  return IUP_NOERROR;
}
コード例 #11
0
ファイル: xmenubar.cpp プロジェクト: dlsocool/dcx
void XMenuBar::removeFromMenuBar(HMENU menubar, XPopupMenu *p_Menu) {
	if ((int) m_vpXMenuBar.size() == 0)
		return;

	// If no menubar is specified, get current menubar.
	if (menubar == NULL) {
		menubar = GetMenu(Dcx::mIRC.getHWND());

		if (!IsMenu(menubar))
			return;
	}

	// Remove the menu from the vector list.
	VectorOfXPopupMenu::iterator itStart = this->m_vpXMenuBar.begin();
	VectorOfXPopupMenu::iterator itEnd = this->m_vpXMenuBar.end();

	while (itStart != itEnd) {
		if (*itStart == p_Menu) {
			this->m_vpXMenuBar.erase(itStart);
			break;
		}

		++itStart;
	}

	const int offset = findMenuOffset(menubar, p_Menu);

	if (offset > 0)
		RemoveMenu(menubar, offset, MF_BYPOSITION);

	DrawMenuBar(Dcx::mIRC.getHWND());
}
コード例 #12
0
ファイル: iupwin_menu.c プロジェクト: Archs/iup-aio
static int winSubmenuMapMethod(Ihandle* ih)
{
  if (!ih->parent || !IsMenu((HMENU)ih->parent->handle))
    return IUP_ERROR;

  return iupBaseTypeVoidMapMethod(ih);
}
コード例 #13
0
ファイル: iupwin_menu.c プロジェクト: svn2github/iup-iup
static int winSubmenuMapMethod(Ihandle* ih)
{
  if (!ih->parent || !IsMenu((HMENU)ih->parent->handle))
    return IUP_ERROR;

  ih->handle = (InativeHandle*)-1; /* fake value just to indicate that it is already mapped */

  return IUP_NOERROR;
}
コード例 #14
0
ファイル: Menu.c プロジェクト: xpika/winhugs
static void hugsprim_IsMenu_6(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsBool res1;
    arg1 = hugs->getPtr();
    res1 = IsMenu(arg1);
    hugs->putBool(res1);
    hugs->returnIO(hugs_root,1);
}
コード例 #15
0
ファイル: iupwin_menu.c プロジェクト: mwoz/Hildim.Source
static int winSubmenuMapMethod(Ihandle* ih)
{
  if (!ih->parent || !IsMenu((HMENU)ih->parent->handle))
    return IUP_ERROR;

  /* will map as void here, but later when the "child" menu is mapped 
     the submenu handle receives the "parent" menu handle in winSubmenuAddToParent,
     because the submenu needs the child menu to be created in the native system. */
  return iupBaseTypeVoidMapMethod(ih);
}
コード例 #16
0
ファイル: wb_control_menu.c プロジェクト: Darksynx/WinBinder
BOOL wbSetMenuItemText(PWBOBJ pwbo, LPCTSTR pszText)
{
	if(!pwbo || !pwbo->hwnd || !IsMenu((HMENU)pwbo->hwnd))
		return FALSE;

	if(pszText && *pszText)
		return ModifyMenu((HMENU)pwbo->hwnd, pwbo->id, MF_BYCOMMAND | MF_STRING, pwbo->id, pszText);
	else
		return FALSE;
}
コード例 #17
0
ファイル: NtUserCallNoParam.c プロジェクト: Moteesh/reactos
void
Test_NoParamRoutine_CreateMenu(void) /* 0 */
{
    HMENU hMenu;

    hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENU);
    TEST(IsMenu(hMenu) == TRUE);
    DestroyMenu(hMenu);

}
コード例 #18
0
ファイル: wb_control_menu.c プロジェクト: Darksynx/WinBinder
BOOL wbSetMenuItemImage(PWBOBJ pwbo, HANDLE hImage)
{
	if(!pwbo || !pwbo->hwnd || !IsMenu((HMENU)pwbo->hwnd))
		return FALSE;

	if(hImage)
		return SetMenuItemBitmaps((HMENU)pwbo->hwnd, pwbo->id, MF_BYCOMMAND, (HBITMAP)hImage, (HBITMAP)hImage);
	else
		return FALSE;
}
コード例 #19
0
void CMainMenu::ResetMenu(void) 
{
	WriteTrace(TraceDebug,__FUNCTION__ ": Start");
	if (!g_Settings->LoadBool(UserInterface_InFullScreen))
	{
		//Create a new window with all the items
		WriteTrace(TraceDebug,__FUNCTION__ ": Create Menu");
		HMENU hMenu = (HMENU)CreateMenu();
		FillOutMenu(hMenu);
		WriteTrace(TraceDebug,__FUNCTION__ ": Create Menu Done");

		//save old menu to destroy latter
		HMENU OldMenuHandle;
		{
			CGuard Guard(m_CS);
			OldMenuHandle = m_MenuHandle;

			//save handle and re-attach to a window
			WriteTrace(TraceDebug,__FUNCTION__ ": Attach Menu");
			m_MenuHandle = hMenu;
		}
		_Gui->SetWindowMenu(this);

		WriteTrace(TraceDebug,__FUNCTION__ ": Remove plugin menu");
		if (g_Plugins->Gfx() != NULL && IsMenu((HMENU)g_Plugins->Gfx()->GetDebugMenu()))
		{
			RemoveMenu((HMENU)OldMenuHandle,(DWORD)g_Plugins->Gfx()->GetDebugMenu(), MF_BYCOMMAND); 
		}
		if (g_Plugins->RSP() != NULL && IsMenu((HMENU)g_Plugins->RSP()->GetDebugMenu()))
		{
			RemoveMenu((HMENU)OldMenuHandle,(DWORD)g_Plugins->RSP()->GetDebugMenu(), MF_BYCOMMAND); 
		}
		WriteTrace(TraceDebug,__FUNCTION__ ": Destroy Old Menu");

		//Destroy the old menu
		DestroyMenu((HMENU)OldMenuHandle); 
	}

	ResetAccelerators();

	WriteTrace(TraceDebug,__FUNCTION__ ": Done");
}
コード例 #20
0
ファイル: main.cpp プロジェクト: slotwin/miranda-ng
INT_PTR StartupSilence()
{
	InitSettings();
	HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
	mir_forkthread((pThreadFunc)AdvSt, NULL);
	CreateServiceFunction(SS_SERVICE_NAME, SturtupSilenceEnabled);
	CreateServiceFunction(SS_SILENCE_CONNECTION, SilenceConnection);
	IsMenu();
	HookEvent(ME_OPT_INITIALISE, InitializeOptions);
	return 0;
}
コード例 #21
0
ファイル: mymenuView.cpp プロジェクト: ngphloc/agmagic
void CMymenuView::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
{
	BOOL setflag=FALSE;
	if(lpMeasureItemStruct->CtlType==ODT_MENU){
		if(IsMenu((HMENU)lpMeasureItemStruct->itemID)&&BCMenu::IsMenu((HMENU)lpMeasureItemStruct->itemID)){
			popmenu.MeasureItem(lpMeasureItemStruct);
			setflag=TRUE;
		}
	}
	if(!setflag)CView::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
}
コード例 #22
0
ファイル: NtUserCallNoParam.c プロジェクト: hoangduit/reactos
INT
Test_NoParamRoutine_CreatePopupMenu(PTESTINFO pti) /* 1 */
{
	HMENU hMenu;

	hMenu = (HMENU)NtUserCallNoParam(_NOPARAM_ROUTINE_CREATEMENUPOPUP);
	TEST(IsMenu(hMenu) == TRUE);
	DestroyMenu(hMenu);

	return APISTATUS_NORMAL;
}
コード例 #23
0
ファイル: C4Gui.cpp プロジェクト: lluchs/clonk-rage
void Element::RemoveElement(Element *pChild)
	{
	// child removed: forward to parent
	if (pParent)
		pParent->RemoveElement(pChild);
	else if (this != Screen::GetScreenS())
		// always ensure removal from screen!
		if (Screen::GetScreenS())
			// but not if this is the context menu, to avoid endless flip-flop!
			if (!IsMenu())
				Screen::GetScreenS()->RemoveElement(pChild);
	}
コード例 #24
0
ファイル: wb_control_menu.c プロジェクト: Darksynx/WinBinder
BOOL wbGetMenuItemChecked(PWBOBJ pwbo)
{
	MENUITEMINFO mi;

	if(!pwbo || !pwbo->hwnd || !IsMenu((HMENU)pwbo->hwnd))
		return FALSE;

	mi.cbSize = sizeof(MENUITEMINFO);
	mi.fMask = MIIM_STATE;

	GetMenuItemInfo((HMENU)pwbo->hwnd, pwbo->id, FALSE, &mi);
	return mi.fState ? TRUE : FALSE;
}
コード例 #25
0
ファイル: BtnST.cpp プロジェクト: diduoren/youeryuan
void CButtonST::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
{
	BOOL bSetFlag = FALSE;
	if (lpMeasureItemStruct->CtlType == ODT_MENU)
	{
		if (IsMenu((HMENU)lpMeasureItemStruct->itemID) && BCMenu::IsMenu((HMENU)lpMeasureItemStruct->itemID))
		{
			m_menuPopup.MeasureItem(lpMeasureItemStruct);
			bSetFlag = TRUE;
		} // if
	} // if
	if (!bSetFlag) CButton::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
} // End of OnMeasureItem
コード例 #26
0
ファイル: NewProperty.cpp プロジェクト: Zero3K/connectfusion
BOOL CNewPropertySheet::OnInitDialog()
{
  BOOL bRetval = CPropertySheet::OnInitDialog();

  HMENU hMenu = m_SystemNewMenu.Detach();
  HMENU hSysMenu = ::GetSystemMenu(m_hWnd,FALSE);
  if(hMenu!=hSysMenu)
  {
    if(IsMenu(hMenu))
    {
      ::DestroyMenu(hMenu);
    }
  }
  m_SystemNewMenu.Attach(hSysMenu);
  m_DefaultNewMenu.LoadMenu(::GetMenu(m_hWnd));

  if(IsMenu(m_DefaultNewMenu.m_hMenu))
  {
    UpdateMenuBarColor(m_DefaultNewMenu);
  }

  return bRetval;
}
コード例 #27
0
ファイル: TaskButton.cpp プロジェクト: Superxwolf/nModules
TaskButton::TaskButton(IPane *parent, IPainter *backgroundPainter, IPainter *textPainter,
    IEventHandler *eventHandler, HWND window, TaskData &taskData)
  : mEventHandler(eventHandler)
  , mIconPainter(nullptr)
  , mMenu(nullptr)
  , mMenuWindow(nullptr)
  , mOverlayIconPainter(nullptr)
  , mTaskData(taskData)
  , mFlashInterval(0)
  , mWindow(window)
{
  mIconPosition = NRECT(NLENGTH(0, 0, 0), NLENGTH(0, 0, 0), NLENGTH(0, 0, 32), NLENGTH(0, 0, 32));
  mIconPainter = nCore::CreateImagePainter();
  mIconPainter->SetPosition(mIconPosition, nullptr);
  mIconPainter->SetImage(nCore::GetWindowIcon(window, 32));

  mOverlayIconPosition =
    NRECT(NLENGTH(0, 0, 16), NLENGTH(0, 0, 16), NLENGTH(0, 0, 32), NLENGTH(0, 0, 32));
  mOverlayIconPainter = nCore::CreateImagePainter();
  mOverlayIconPainter->SetPosition(mOverlayIconPosition, nullptr);

  PaneInitData initData;
  ZeroMemory(&initData, sizeof(PaneInitData));
  initData.cbSize = sizeof(PaneInitData);
  initData.messageHandler = this;
  IPainter *painters[] = { backgroundPainter, textPainter, mIconPainter, mOverlayIconPainter };
  initData.painters = painters;
  initData.numPainters = _countof(painters);
  initData.states = gButtonStates;
  initData.numStates = gNumButtonStates;
  mPane = parent->CreateChild(&initData);

  if (IsIconic(window)) {
    ActivateState(State::Minimized);
  }
  if (window == gActiveWindow) {
    ActivateState(State::Active);
  }

  wchar_t windowText[256];
  GetWindowText(window, windowText, 256);
  mPane->SetText(windowText);

  // Reset the system menu for the window
  mMenu = GetSystemMenu(mWindow, FALSE);
  if (!IsMenu(mMenu)) {
    GetSystemMenu(mWindow, TRUE);
    mMenu = GetSystemMenu(mWindow, FALSE);
  }
}
コード例 #28
0
void CDCGFFrameWindow::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
{
	BOOL setflag=FALSE;
	if(lpMeasureItemStruct->CtlType==ODT_MENU){
		if(IsMenu((HMENU)lpMeasureItemStruct->itemID)){
			CMenu* cmenu = 
				CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
			
			if(m_Menu.IsMenu(cmenu)||m_DefaultMenu.IsMenu(cmenu)){
				m_Menu.MeasureItem(lpMeasureItemStruct);
				setflag=TRUE;
			}
		}
	}
	
	if(!setflag)CMDIFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);	
}
コード例 #29
0
ファイル: wb_control_menu.c プロジェクト: Darksynx/WinBinder
BOOL wbSetMenuItemChecked(PWBOBJ pwbo, BOOL bState)
{
	if(!pwbo || !pwbo->hwnd || !IsMenu((HMENU)pwbo->hwnd))
		return FALSE;

	/*
	MENUITEMINFO mi;

	mi.cbSize = sizeof(MENUITEMINFO);
	mi.fMask = MIIM_STATE;
	mi.fState = bState ? MFS_CHECKED : MFS_UNCHECKED;

	return SetMenuItemInfo(pwbo->hwnd, pwbo->id, FALSE, &mi);
	*/

	return (CheckMenuItem((HMENU)pwbo->hwnd, pwbo->id, bState ? MF_CHECKED : MF_UNCHECKED) != 0xFFFFFFFF);
}
コード例 #30
0
ファイル: SMenu.cpp プロジェクト: 3rdexp/soui
UINT SMenu::TrackPopupMenu(
    UINT uFlags,
    int x,
    int y,
    HWND hWnd,
    LPCRECT prcRect
)
{
    SASSERT(IsMenu(m_hMenu));

    SMenuODWnd menuOwner(hWnd);
    *(static_cast<SMenuAttr*>(&menuOwner))=m_menuAttr;
    menuOwner.Create(NULL,WS_POPUP,WS_EX_NOACTIVATE,0,0,0,0,NULL,NULL);
    UINT uNewFlags=uFlags|TPM_RETURNCMD;
    UINT uRet=::TrackPopupMenu(m_hMenu,uNewFlags,x,y,0,menuOwner.m_hWnd,prcRect);
    menuOwner.DestroyWindow();
    if(uRet && !(uFlags&TPM_RETURNCMD)) ::SendMessage(hWnd,WM_COMMAND,uRet,0);
    return uRet;
}