网页功能: 加入收藏 设为首页 网站搜索  
类似IE地址栏的自动完成功能
发表日期:2003-04-18作者:[] 出处:  

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

我来说两句】 【加入收藏】 【返加顶部】 【打印本页】 【关闭窗口
中搜索 类似IE地址栏的自动完成功能
本类热点文章
  用VB制作软键盘
  让messagebox自动消失
  制作半透明窗体
  给Listview做个背景
  VB程序实现WindowsXP效果的界面
  VB打造超酷个性化菜单
  用VB实现“百叶窗”的图形特效
  用VB绘制正弦动画曲线
  获取所有打印纸张格式的方法
  如何使Form的背景图随Form大小改变
  VB实现立体文字
  使用文字做为窗体的形状
最新分类信息我要发布 
最新招聘信息

关于我们 / 合作推广 / 给我留言 / 版权举报 / 意见建议 / 广告投放  
Copyright ©2003-2019 Lihuasoft.net webmaster(at)lihuasoft.net
网站编程QQ群   京ICP备05001064号 页面生成时间:0.00561