描述:
//////////////////以下是COMBOBOX头文件////////////////////////
#ifndef __BANDEDITCTRL_H_
#define __BANDEDITCTRL_H_
#include <atlctrls.h>
#include <atlmisc.h>
#include <commctrl.h>
class CToolBandObj;
/////////////////////////////////////////////////////////////////////////////
// CBandEditCtrl
class CBandEditCtrl : public CWindowImpl<CBandEditCtrl, CComboBox>,
public IDropTarget
{
public:
CBandEditCtrl();
virtual ~CBandEditCtrl();
// Operations
public:
STDMETHOD(TranslateAcceleratorIO)(LPMSG pMsg)
{
MessageBox(_T("asdfssss"));
int nVirtKey = (int)(pMsg->wParam);
if(nVirtKey==VK_TAB)
return S_OK;
if (WM_KEYUP == pMsg->message && VK_RETURN == nVirtKey && pMsg->hwnd==m_edit2.m_hWnd)
{
MessageBox(_T("adsf"));
return S_OK;
}
else if (
VK_BACK == nVirtKey ||
(VK_END <= nVirtKey && VK_LEFT >= nVirtKey) || VK_RIGHT == nVirtKey ||
VK_DELETE == nVirtKey || ( (GetKeyState(VK_CONTROL)&0x80) && (nVirtKey=='C' || nVirtKey=='V' || nVirtKey=='X')))
{
MessageBox(_T("adsf"));
m_auto = false;
TranslateMessage(pMsg);
DispatchMessage(pMsg);
m_auto = true;
if(WM_KEYDOWN == pMsg->message && VK_BACK == nVirtKey)
{
MessageBox(_T("adsf"));
m_auto = false;
}
return S_OK;
}
else
return S_FALSE;
}
// Support Drag and Drop
STDMETHODIMP QueryInterface(REFIID, VOID**);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
STDMETHODIMP DragEnter(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
STDMETHODIMP DragOver(DWORD, POINTL, LPDWORD);
STDMETHODIMP DragLeave(void);
STDMETHODIMP Drop(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
DECLARE_WND_SUPERCLASS(NULL, TEXT("COMBOBOX"))
BEGIN_MSG_MAP(CBandEditCtrl)
OCM_COMMAND_CODE_HANDLER(CBN_SETFOCUS, OnSetFocus)
END_MSG_MAP()
CToolBandObj* m_pBand;
LPDATAOBJECT m_pIDataObject;
HWND m_hWndCtl;
protected:
CContainedWindow m_edit2;
LRESULT OnSetFocus(WORD, WORD pnmh, HWND,BOOL& );
protected:
ULONG m_cRef;
bool m_auto;
};
#endif //__BANDEDITCTRL_H_
//////////////////////////////////////////////////////
以下是建立COMBOBOX的代码!!!!!!!
m_ctlBandEdit.Create(hWnd, rect, NULL,WS_VSCROLL |WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL|WS_TABSTOP|CBS_DROPDOWN, WS_EX_CLIENTEDGE);
m_ctlBandEdit.SetFont((HFONT)GetStockObject( DEFAULT_GUI_FONT ));
m_ctlBandEdit.InitStorage(2,10);
m_ctlBandEdit.SetCurSel(0);
/////////////////////////////////////
现在的问题是在COMBOBOX输入字符的时候无法向应键盘输入的任何东西.是不是哪点写错了望高人指教
对不住各位我只有60分了.要的话另外加