Rubrik: HTML/Internet/Netzwerk · Internet / Browser / IE | VB-Versionen: VB4, VB5, VB6 | 04.11.00 |
Verwenden des AutoComplete-Features Eines der coolsten Features, die der Internet Explorer bereitstellt, ist meiner Ansicht nach die 'AutoComplete'-Funktion. Sie zeigt, sobald der User... | ||
Autor: Unbekannt | Bewertung: | Views: 19.664 |
ohne Homepage | System: Win9x, WinNT, Win2k, WinXP, Win7, Win8, Win10, Win11 | Beispielprojekt auf CD |
Eines der coolsten Features, die der Internet Explorer bereitstellt, ist meiner Ansicht nach die 'AutoComplete'-Funktion. Sie zeigt, sobald der User die ersten Zeichen in ein Tetxtfeld eingibt, ein Auswahlmenü mit vermutlich gesuchten URLs oder Verzeichnisen an. Ab dem Internet Explorer 5 ist dieses Feature auch VB-Programmierern zugänglich:
' Deklarationen: Private Declare Function SHAutoComplete Lib "shlwapi" ( _ ByVal hWnd As Long, _ ByVal dwFlags As Long) As Long ' // Currently (SHACF_FILESYSTEM | SHACF_URLALL) Const SHACF_DEFAULT = &H0 ' // This includes the File System as well as the rest ' of the shell (Desktop\My Computer\Control Panel\) Const SHACF_FILESYSTEM = &H1 ' // URLs in the User's History Const SHACF_URLHISTORY = &H2 ' // URLs in the User's Recently Used list. Const SHACF_URLMRU = &H4 ' // URLs in the User's Recently Used list. Const SHACF_USETAB = &H8 ' // Don't AutoComplete non-File System items. Const SHACF_FILESYS_ONLY = &H10 Const SHACF_URLALL = (SHACF_URLHISTORY Or SHACF_URLMRU) ' // Ignore the registry default and force the feature on. Const SHACF_AUTOSUGGEST_FORCE_ON = &H10000000 ' // Ignore the registry default and force the feature off. Const SHACF_AUTOSUGGEST_FORCE_OFF = &H20000000 ' // Ignore the registry default and force the feature on. ' (Also know as AutoComplete) Const SHACF_AUTOAPPEND_FORCE_ON = &H40000000 ' // Ignore the registry default and force the feature off. ' (Also know as AutoComplete) Const SHACF_AUTOAPPEND_FORCE_OFF = &H80000000 Function EnableAutoComplete(hWnd As Long, dwFlags As Long) _ As Boolean ' Aktiviert das AutoComplete-feature für die ' angegebene Textbox. Falls die aktuelle IE-Version ' dies nicht unterstützt, wird FALSE zurückgegeben On Error GoTo Err_AutoComplete SHAutoComplete hWnd, dwFlags EnableAutoComplete = True Exit Function Err_AutoComplete: EnableAutoComplete = False End FunctionBeispiel, benötigt ein Textfeld (Text1):
Private Sub Form_Load() EnableAutoComplete Text1.hWnd, 0& End Sub