描述:
class CStockBar :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CStockBar, &CLSID_StockBar>,
public IStockBar,
public IDeskBand,
public IObjectWithSite,
public IPersistStream,
public IInputObject,
....................................
....................................
....................................
....................................
STDMETHODIMP CStockBar::TranslateAcceleratorIO(LPMSG lpMsg)
{
// the only window that needs to translate messages is our edit box so forward them.
CEditQuote * pEQ = &m_ReflectWnd.GetToolBar().GetEditBox();
return pEQ->TranslateAcceleratorIO(lpMsg);
}
我已经处理了TranslateAcceleratorIO,这是为什么啊? 但是还是没有办法用backspace 退格
解决方案1:
STDMETHODIMP CStockBar::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
{
// if our deskband is being activated then set focus to the edit box.
if(fActivate)
{
m_ReflectWnd.GetToolBar().GetEditBox().SetFocus();
}
return S_OK;
}
void CStockBar::FocusChange(BOOL bHaveFocus)
{
if (m_pSite)
{
IUnknown* pUnk = NULL;
if (SUCCEEDED(QueryInterface(IID_IUnknown, (LPVOID*)&pUnk)) && pUnk != NULL)
{
m_pSite->OnFocusChangeIS(pUnk, bHaveFocus);
pUnk->Release();
pUnk = NULL;
}
}
}
BEGIN_MSG_MAP(CEditQuote)
COMMAND_CODE_HANDLER(EN_SETFOCUS, OnSetFocus)
END_MSG_MAP()
RESULT CEditQuote::OnSetFocus(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
//Notify host that our band has the focus so TranslateAcceleratorIO
//messages are directed towards our band.
if (m_pBand) m_pBand->FocusChange(TRUE);
return 0;
}