浅谈vb下的shellwindows

       今天一同学找我帮忙,说要修改一下一网页的内容,当然这里所说的修改是本地修改,于是我便想到了shellwindows这个对象.拿起很久没用的vb写起.

先说一下这个对象怎么加载,点工程------引用,选择microsoft internet controls即可.

下面看代码:

  1. Dim w As New ShellWindows
  2. Private Sub Form_Load()
  3. Me.Visible = False
  4. t.Interval = 1
  5. t.Enabled = True
  6. End Sub
  7. Private Sub t_Timer()
  8. On Error Resume Next
  9. Dim i As Object
  10. For Each i In w
  11. If InStr(i.LocationURL, "*******"Then
  12. If InStr(i.Document.getElementById("zhuti").contentWindow.Document.body.innerText, "*******"Then
  13. If i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(0).innerText = "********" Then
  14. i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(106).innerText = ""
  15. i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(104).innerText = "80"
  16. i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(103).innerText = "3.0"
  17. Exit For
  18. ElseIf i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(0).innerText = "********" Then
  19. i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(148).innerText = "3.0"
  20. i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(149).innerText = "80"
  21. i.Document.getElementById("zhuti").contentWindow.Document.getElementsByTagName("td").Item(151).innerText = ""
  22. Exit For
  23. End If
  24. End If
  25. End If
  26. Next
  27. End Sub

代码很简单,主要是shellwindows的用法,该对象会得到windiws下shell窗口对象,也就是说你可以用这个对象来操控windows的文件夹和ie浏览器,很不错吧

下面提供下这个对象的几个方法和属性

document(只用于ie):文档对象.

navigate:地址跳转

hwnd:窗口句柄

hide:隐藏

show:显示

quit:关闭

locationurl:当前网址

locationname:当前文档标题

 

熟悉vbscript的还可以用shell.application下的windows对象,它的功能和vb下shellwindows是一样的.

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值