Not a Member Yet,
Click here to Register
How do you like the new design?
It's cool, great job
[tally: 70%] 70%
It's okay
[tally: 20%] 20%
Its OK but I liked the old layout better
[tally: 0%] 0%
Please bring the old one back
[tally: 10%] 10%

votes: 10

ID: 335
Viewed: 2925
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

' Add this to a form with a Label (Label1) textbox (Text1) and
' a command button (Command1)
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Copyright ©1996-2000 VBnet, Randy Birch, All Rights Reserved.
Some pages may also contain other copyrights by the author.


You are free to use this code within your own applications,
but you are expressly forbidden from selling or otherwise
distributing this source code without prior written consent.
This includes both posting free demo projects made from this
code as well as reproducing the code in text or html format.

Highlight all by clicking in box
<!---Declaration--->
Option Explicit
'Flags to control the operation of SHAutoComplete.
'The first four are used to override the Internet
'Explorer registry settings. The user can change
'these settings manually by launching the Internet
'Options property sheet from the Tools menu and
'clicking the Advanced tab.The last five can be
'used to specify which files or URLs will be
'available for autoappend or autosuggest operations.

'Ignore registry default and force feature on
Private Const SHACF_AUTOSUGGEST_FORCE_ON As Long = &H10000000

'Ignore registry default and force feature off.
Private Const SHACF_AUTOSUGGEST_FORCE_OFF As Long = &H20000000

'Ignore registry default and force feature on. (Also know as AutoComplete)
Private Const SHACF_AUTOAPPEND_FORCE_ON As Long = &H40000000

'Ignore registry default and force feature off. (Also know as AutoComplete)
Private Const SHACF_AUTOAPPEND_FORCE_OFF As Long = &H80000000

'Currently (SHACF_FILESYSTEM | SHACF_URLALL)
Private Const SHACF_DEFAULT As Long = &H0

'Includes the File System as well as the rest
'of the shell (DesktopMy ComputerControl Panel)
Private Const SHACF_FILESYSTEM As Long = &H1

'URLs in the User's History
Private Const SHACF_URLHISTORY As Long = &H2

'URLs in the User's Recently Used list
Private Const SHACF_URLMRU As Long = &H4

Private Const SHACF_URLALL As Long = (SHACF_URLHISTORY Or SHACF_URLMRU)

'Identifies the platform for which the DLL was built.
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.dll" _
(ByVal hwndEdit As Long, _
ByVal dwFlags As Long) As Long

Private Declare Function DllGetVersion _
Lib "Shlwapi.dll" _
(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

Highlight All
<!---Code--->
Private Sub Command1_Click()

Dim DVI As DllVersionInfo

If GetIEVersion(DVI) >= 5 Then

'Turn on auto-complete
Call SHAutoComplete(Text1.hWnd, SHACF_DEFAULT)

'update the captions and set focus to the textbox
Command1.Caption = "SHAutoComplete is On"
Command1.Enabled = False
Text1.SetFocus
Text1.SelStart = Len(Text1.Text)

Else

'damn!
MsgBox "Sorry ... you need IE5 to use this demo", vbExclamation

End If

End Sub


Private Sub Form_Load()

'dim a DllVersionInfo type
Dim DVI As DllVersionInfo

'display the version of Shlwapi
Label1 = "Using Shlwapi.dll for " & GetIEVersionString

'if not 5 or greater, can't do it
Command1.Enabled = GetIEVersion(DVI) >= 5
Command1.Caption = "SHAutoComplete is Off"

End Sub;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions