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 退格
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 退格
{
// 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;
}
class CEditQuote : public CWindowImpl<CEditQuote>
{
public:
DECLARE_WND_SUPERCLASS(TEXT("Caoy_Test"), TEXT("COMBOBOX")) BEGIN_MSG_MAP(CEditQuote)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
COMMAND_CODE_HANDLER(CBN_SETFOCUS, OnSetFocus)
COMMAND_CODE_HANDLER(EN_SETFOCUS, OnEnSetFocus)
ALT_MSG_MAP(1)
MESSAGE_HANDLER(WM_CHAR, OnChar)
END_MSG_MAP() LRESULT OnSetFocus(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnEnSetFocus(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
CEditQuote();
virtual ~CEditQuote();
STDMETHOD(TranslateAcceleratorIO)(THIS_ LPMSG lpMsg);
void SetBand(CStockBar* pBand);
CContainedWindow m_EditCtrl;
private:
CStockBar* m_pBand;
LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};//下面这两个函数相同
LRESULT 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;
}LRESULT CEditQuote::OnEnSetFocus(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;
}
COMMAND_CODE_HANDLER(EN_SETFOCUS, OnEnSetFocus)