none
"如何使ComboBox不对输入字符串长度作限制 ? RRS feed

答案

  • 默认情况下ComboBox允许输入字符个数是30,000 TCHARs,即时不限制用户输入个数,该控件最大也只能允许0x7FFFFFFE 字符,即1861152495。

    以下提供设置允许输入到0x7FFFFFFE字符的代码:
    Private Declare Function SendMessage Lib "user32" _
    Alias "SendMessageA" (ByVal hwnd As Long, _
    ByVal wMsg As Long, ByVal wParam As Long, _
    lParam As Any) As Long

    Private Const CB_LIMITTEXT = &H141

    SendMessage CB.hwnd, CB_LIMITTEXT, 0&, 0&

     

    2007年8月2日 8:49