例:我第一次在文本框中打入一个字符串“记忆的功能”
当我第二次打入"记忆"时,就自动回出现“的功能”三个字符匹配上去
有没有这样的API啊?

解决方案 »

  1.   

    这和文本的撤消操作一样,没有必要使用API,使用一个数组来赋值吧,然后每次键入相关字符时查找这个数组,用它匹配上去
      

  2.   

    like thisThis code snippet turns a normal combobox into an autocomplete combo like the Internet Explorer Address Bar. Code:Private Declare Function SendMessageString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long 
    Private Const CB_FINDSTRING = &H14C 
    Private blnDelete As Boolean Private Sub Combo1_Change() 
      Dim nRet As Long 
      Dim nSelStart As Long 
      If blnDelete Then Exit Sub 
      nRet = SendMessageString(Combo1.hwnd, CB_FINDSTRING, 0, Combo1.Text) 
      Debug.Print Combo1.Text 
      nSelStart = Combo1.SelStart 
      If nRet >= 0 Then 
        Combo1.ListIndex = nRet 
        Combo1.SelStart = nSelStart 
        Combo1.SelLength = Len(Combo1.Text) 
      End If 
    End Sub Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer) 
      Select Case KeyCode 
        Case vbKeyDelete, vbKeyBack 
          blnDelete = True 
        Case Else 
          blnDelete = False 
      End Select 
    End Sub