오후 4:26 00-01-22 조경민 bro@shinbiro.com
========================================================

콤보 박스

일딴 드룹 리스트되어서 하나 선택을 하게 되면

CBN_SELENDOK
CBN_CLOSEUP
CBN_SELCHANGE
순으로 호출된다.


어쨋든 콤보 박스 선택시 그 값을 얻어오기
void CLeftMainView::OnSelchangeRoot()
{

        int nSel = m_ComboRoot.GetCurSel();

        if( nSel != CB_ERR )
        {
                m_ComboRoot.GetLBText( nSel , sRootName ) ;
        }


: ---------------------
콤보박스에서 엔터 처리

WNDPROC fnOldEdit;
LRESULT CALLBACK ComboProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);


//메인 프레임의 OnCreate함수에서 서브클래싱을 합니다.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
        CComboBox* pCombo = (CComboBox*) m_wndMyBar.GetDlgItem(IDC_PALETTE);
                                                                              
        fnOldEdit = (WNDPROC) ::SetWindowLong(pCombo->GetSafeHwnd(), GWL_WNDPROC
, (LONG)ComboProc);
...
}


LRESULT CALLBACK ComboProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
        CView* pWnd = (CView*)(((CFrameWnd*)AfxGetMainWnd())->GetActiveView());

        switch(iMsg)
        {
                case WM_KEYUP :
                        switch(wParam)
                        {                                        
-----------------------------------------------------------------------------
                        case VK_RETURN :
                                //pWnd->SendMessage(MY_CHANGE_MSG);
                                //하고 싶은 일을 합니다.
                                break;
                        default : break;
                        }
                        break;
                default : break;
        }

        return CallWindowProc(fnOldEdit, hwnd, iMsg, wParam, lParam);
}
                                                                              

+ Recent posts