请问诸位DX。
我的界面需要ComboBox控件但是没用MFC
如何操作控件啊?谢谢
解决立马结帐

解决方案 »

  1.   

    通过SendMessage,具体有哪些消息,你在MSDN的索引中输入“CB_”和CBN_,就可以看到了。
      

  2.   

    For example:SendMessage(hWndCB, CB_ADDSTRING, 0, (LPARAM)lpszString);
      

  3.   

    sendmessage.
    去跟一下MFC的代码就知道了,MFC也是用sendmessage实现的。
      

  4.   

    SendMessage!
    看来今天抢分的人不少!
      

  5.   

    SendMessage!
    同意
    DentistryDoctor(雅克医生<改行做程序员了>)
      

  6.   

    SendMessage()
    SendMessage( 
      (HWND) hWnd,              // handle to destination window 
      CB_ADDSTRING,             // message to send
      (WPARAM) wParam,          // not used; must be zero
      (LPARAM) lParam          // string to add (LPCTSTR)
    );
    Parameters
    wParam 
    This parameter is not used. 
    lParam 
    Pointer to the null-terminated string to be added. If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the value of the lParam parameter is stored as item data rather than the string it would otherwise point to. The item data can be retrieved or modified by sending the CB_GETITEMDATA or CB_SETITEMDATA message. 
    Return Values
    The return value is the zero-based index to the string in the list box of the combo box. If an error occurs, the return value is CB_ERR. If insufficient space is available to store the new string, it is CB_ERRSPACE. Res
    If you create an owner-drawn combo box with the CBS_SORT style but without the CBS_HASSTRINGS style, the WM_COMPAREITEM message is sent one or more times to the owner of the combo box so the new item can be properly placed in the list. To insert a string at a specific location within the list, use the CB_INSERTSTRING message. If the combo box has WS_HSCROLL style and you add a string wider than the combo box, send a LB_SETHORIZONTALEXTENT message to ensure the horizontal scrollbar appears.
      

  7.   

    CB_ADDSTRING
    CB_DELETESTRING
    CB_DIR
    CB_FINDSTRING
    CB_FINDSTRINGEXACT
    CB_GETCOUNT
    CB_GETCURSEL
    CB_GETDROPPEDCONTROLRECT
    CB_GETDROPPEDSTATE
    CB_GETDROPPEDWIDTH
    CB_GETEDITSEL
    CB_GETEXTENDEDUI
    CB_GETHORIZONTALEXTENT
    CB_GETITEMDATA
    CB_GETITEMHEIGHT
    CB_GETLBTEXT
    CB_GETLBTEXTLEN
    CB_GETLOCALE
    CB_GETTOPINDEX
    CB_INITSTORAGE
    CB_INSERTSTRING
    CB_LIMITTEXT
    CB_RESETCONTENT
    CB_SELECTSTRING
    CB_SETCURSEL
    CB_SETDROPPEDWIDTH
    CB_SETEDITSEL
    CB_SETEXTENDEDUI
    CB_SETHORIZONTALEXTENT
    CB_SETITEMDATA
    CB_SETITEMHEIGHT
    CB_SETLOCALE
    CB_SETTOPINDEX
    CB_SHOWDROPDOWN
    CBN_CLOSEUP
    CBN_DBLCLK
    CBN_DROPDOWN
    CBN_EDITCHANGE
    CBN_EDITUPDATE
    CBN_ERRSPACE
    CBN_KILLFOCUS
    CBN_SELCHANGE
    CBN_SELENDCANCEL
    CBN_SELENDOK
    CBN_SETFOCUS
    WM_COMPAREITEM
    WM_DRAWITEM
    WM_MEASUREITEM