Option Explicit Private Const SHACF_AUTOSUGGEST_FORCE_ON As Long = &H10000000 Private Const SHACF_AUTOSUGGEST_FORCE_OFF As Long = &H20000000 Private Const SHACF_AUTOAPPEND_FORCE_ON As Long = &H40000000 Private Const SHACF_AUTOAPPEND_FORCE_OFF As Long = &H80000000 Private Const SHACF_DEFAULT As Long = &H0 Private Const SHACF_FILESYSTEM As Long = &H1 Private Const SHACF_URLHISTORY As Long = &H2 Private Const SHACF_URLMRU As Long = &H4 Private Const SHACF_URLALL As Long = (SHACF_URLHISTORY Or SHACF_URLMRU) Private Const DLLVER_PLATFORM_WINDOWS As Long = &H1 'Windows 95 Private Const DLLVER_PLATFORM_NT As Long = &H2 'Windows NT Private Type DllVersionInfo cbSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformID As Long End Type Private Declare Function SHAutoComplete Lib "shlwapi" _ (ByVal hwndEdit As Long, _ ByVal dwFlags As Long) As Long Private Declare Function DllGetVersion Lib "shlwapi" _ (dwVersion As DllVersionInfo) As Long Private Function GetIEVersion(DVI As DllVersionInfo) As Long DVI.cbSize = Len(DVI) Call DllGetVersion(DVI) GetIEVersion = DVI.dwMajorVersion End Function Private Function GetIEVersionString() As String Dim DVI As DllVersionInfo DVI.cbSize = Len(DVI) Call DllGetVersion(DVI) GetIEVersionString = "Internet Explorer " & _ DVI.dwMajorVersion & "." & _ DVI.dwMinorVersion & "." & _ DVI.dwBuildNumber End Function Private Sub Command1_Click() Dim DVI As DllVersionInfo If GetIEVersion(DVI) >= 5 Then Call SHAutoComplete(Text1.hWnd, SHACF_DEFAULT) Command1.Caption = "SHAutoComplete is On" Command1.Enabled = False Text1.SetFocus Text1.SelStart = Len(Text1.Text) Else MsgBox "Sorry ... you need IE5 to use this demo", vbExclamation End If End Sub Private Sub Form_Load() Dim DVI As DllVersionInfo Label1.Caption = "Using Shlwapi.dll for " & GetIEVersionString Command1.Enabled = GetIEVersion(DVI) >= 5 Command1.Caption = "SHAutoComplete is Off" End Sub |