-
Esta api autocompleta con el historial en un cuadro de texto a medida que se escrive en el, este ejemplo puede ser util para hacer un navegador o una selecion de archivos, etc. El ejemplo lo saque del apiguide que utilizaba un textbox yo le agregue el api FindWindowEx para buscar el hwnd del Edit del comboBox
Agregar un ComoboBox1
Código:
Private Const SHACF_AUTOAPPEND_FORCE_OFF = &H80000000
Private Const SHACF_AUTOAPPEND_FORCE_ON = &H40000000
Private Const SHACF_AUTOSUGGEST_FORCE_OFF = &H20000000
Private Const SHACF_AUTOSUGGEST_FORCE_ON = &H10000000
Private Const SHACF_DEFAULT = &H0
Private Const SHACF_FILESYSTEM = &H1
Private Const SHACF_URLHISTORY = &H2
Private Const SHACF_URLMRU = &H4
Private Const SHACF_USETAB = &H8
Private Const SHACF_URLALL = (SHACF_URLHISTORY Or SHACF_URLMRU)
Private Declare Sub SHAutoComplete Lib "shlwapi.dll" (ByVal hwndEdit As Long, ByVal dwFlags As Long)
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Form_Load()
Dim Handle As Long
Handle = FindWindowEx(Combo1.hWnd, 0, "edit", nullstring)
SHAutoComplete Handle, SHACF_DEFAULT
End Sub
Nota: si se quiere usar con un TextBox solo hay que cambiar por esto
SHAutoComplete Text1.hWnd, SHACF_DEFAULT
-
Muy buena Leandro !, en su momento yo lo quise hacer y no me salió, lo tuve que simular
Salu2
-
Me olvidaba, ahora viendo el code, creo que no funcionaba anteriormenteporquela APi ShAutocompletenecesita un hwnd, pero no de control (o sea de ventana), si no que el parametro dice HwndEdit as Long
...es otro tipo de Handle, por eso no funcionaba