请教,我在ATL写的IE Bar插件中的ComboBox框无法下拉,而且也无法输入中文,这是什么原因?具体情况是IE ToolBar上有一个ComboBox框,但是无法点击下压按钮并且没有出现下拉框, 也无法输入中文只能输入英文,但是在程序中用SetWindowText却能正确输入中文,实在没则,求教,求教!

解决方案 »

  1.   

    http://msdn.microsoft.com/msdnmag/issues/01/08/c/
      

  2.   

    谢谢大家,但是我的ComboBox在ATL中是动态创建的,用的是超子类化方式从CWindowImpl派生
    class CEditQuote : public CWindowImpl<CEditQuote>
    {
    public:
    DECLARE_WND_SUPERCLASS(TEXT("Caoy_Test"), TEXT("COMBOBOX")) BEGIN_MSG_MAP(CEditQuote)
    MESSAGE_HANDLER(WM_CREATE, OnCreate)
    MESSAGE_HANDLER(WM_SHOWWINDOW, OnShow)
    COMMAND_CODE_HANDLER(EN_SETFOCUS, OnSetFocus)
    COMMAND_CODE_HANDLER(CBN_DROPDOWN, OnDropDown)
    COMMAND_CODE_HANDLER(CBN_EDITCHANGE, OnEditChange)
    ALT_MSG_MAP(1)
    MESSAGE_HANDLER(WM_CHAR, OnChar);
    END_MSG_MAP() LRESULT OnSetFocus(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 OnDropDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
    LRESULT OnEditChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
    };
    其中 CContainedWindow m_EditCtrl;是用于子类化ComboBox中被复合的EDIT标准控件.
      

  3.   

    COMMAND_CODE_HANDLER(EN_SETFOCUS, OnSetFocus)
    改为
    COMMAND_CODE_HANDLER(CBN_SETFOCUS, OnSetFocus)
      

  4.   

    LRESULT CMFToolbar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
    {
    // based on the size of the window area minus the size of the toolbar button, 
    // indent the toolbar so that we can place the edit box before the toolbar 
    // button. This will right justify the toolbar button in the toolbar and the 
    // edit box will use the vaction space to the left of the button but after the 
    // toolbar text as it's usable space.
    RECT wndRect, btnRect;
    GetClientRect(&wndRect);
    ::SendMessage(m_hWnd, TB_GETITEMRECT, 0, (LPARAM)&btnRect);
    wndRect.right -= (btnRect.right - btnRect.left);
    wndRect.bottom += 100;
    SendMessage(TB_SETINDENT, wndRect.right - wndRect.left);
    // put a small spacing gap between the edit box's right edge and the toolbar button's left edge
    wndRect.right -= 3;
    m_EditWnd.MoveWindow(&wndRect, FALSE);
    return 0;
    }