void CControlContextDlg::OnCbnDropdownCombo1() { CMenu mnuPopupSubmit; mnuPopupSubmit.LoadMenu(IDR_SUBMIT); // Get a pointer to the button //CButton *pButton; CComboBox *pComboBox; pComboBox = reinterpret_cast<CComboBox *>(GetDlgItem(IDC_COMBO1)); // Find the rectangle around the button CRect rectSubmitButton; pComboBox->GetWindowRect(&rectSubmitButton); CPoint pbottom = rectSubmitButton.BottomRight(); int h = rectSubmitButton.Width(); CPoint p; p.x = pbottom.x - h; p.y = pbottom.y; // Get a pointer to the first item of the menu CMenu *mnuPopupMenu = mnuPopupSubmit.GetSubMenu(0); ASSERT(mnuPopupMenu); // Find out if the user right-clicked the button // because we are interested only in the button CPoint point; mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, p.x, p.y, this); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)