USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (ActiveX/Controles/DLL)

Título da Dica:  Função "Auto-completar"
Postada em 23/11/2003 por Josefh Hennyere      Clique aqui para enviar email para o autor  jhennyere@yahoo.com.br
Para testar a função, insira uma TextBox e uma ComboBox em um formulário. O nome da text box usado na função é  "txtTest" e o nome da ComboBox  é "cboTest". Insira o código abaixo no formulário.

Private Sub Form_Load()
   AutoComplete txtTest.hWnd, SHACF_FILESYS_ONLY
   AutoComplete GetComboBoxEdithWnd(cboTest.hWnd), SHACF_FILESYS_ONLY
End Sub

'Agora, insira este aquí em um módulo ".bas"

Option Explicit

Public Enum SHAutoCompleteFlags
   ' // Currently (SHACF_FILESYSTEM | SHACF_URLALL)
   SHACF_DEFAULT = &H0
   ' // This includes the File System as well as the rest of the shell
   ' (Desktop\My Computer\Control Panel\)
   SHACF_FILESYSTEM = &H1
   ' // URLs in the User's History
   SHACF_URLHISTORY = &H2
   ' // URLs in the User's Recently Used list.
   SHACF_URLMRU = &H4
   ' // Use the tab to move thru the autocomplete possibilities
   ' instead of to the next dialog/window control.
   SHACF_USETAB = &H8
   SHACF_URLALL = (SHACF_URLHISTORY Or SHACF_URLMRU)
   ' // This includes the File System
   SHACF_FILESYS_ONLY = &H10                    

'#if (_WIN32_IE >= = &H0600)
   ' // Same as SHACF_FILESYS_ONLY except it only includes directories,
   ' UNC servers, and UNC server shares.
   SHACF_FILESYS_DIRS = &H20                    
'#End If ' // (_WIN32_IE >= = &H0600)
  
   ' // Ignore the registry default and force the feature on.
   SHACF_AUTOSUGGEST_FORCE_ON = &H10000000
   ' // Ignore the registry default and force the feature off.
   SHACF_AUTOSUGGEST_FORCE_OFF = &H20000000
   ' // Ignore the registry default and force the feature on.
   ' (Also know as AutoComplete)
   SHACF_AUTOAPPEND_FORCE_ON = &H40000000
    ' // Ignore the registry default and force the feature off.
    ' (Also know as AutoComplete)
   SHACF_AUTOAPPEND_FORCE_OFF = &H80000000
End Enum

Private Declare Function SHAutoComplete Lib "shlwapi.dll" ( _
   ByVal hwndEdit As Long, ByVal dwFlags As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
   (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As String, _
   ByVal lpszWindow As String) As Long

Private Const S_OK = 0

Public Function AutoComplete( _
      ByVal hWnd As Long, _
      ByVal eFlags As SHAutoCompleteFlags _
   )
Dim lR As Long
   lR = SHAutoComplete(hWnd, eFlags)
   AutoComplete = (lR <> S_OK)
End Function
Public Function GetComboBoxEdithWnd(ByVal hWnd As Long) As Long
   GetComboBoxEdithWnd = FindWindowEx(hWnd, 0, "EDIT", vbNullString)
End Function


                                                                             Josefh Hennyere

 


CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página