| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 438 人关注过本帖
标题:[求助]循环问题大家谁会近来看看~~
只看楼主 加入收藏
a6408425
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-7-9
收藏
 问题点数:0 回复次数:2 
[求助]循环问题大家谁会近来看看~~

Option Explicit
Private Declare Function PostMessage Lib "User32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long '发送消息,用来关闭指定程序
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long '查找窗体
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Const WM_CLOSE = &H10 '关闭程序

Private Sub Form_Load()

WebBrowser1.Navigate "http://alexa.alexacn.net/ipzhxx.asp"
End Sub
Private Sub Command1_Click()

Sleep 18000000
Dim winHwnd As Long
Dim RetVal As Long
winHwnd = FindWindow(vbNullString, "河南网通宽带用户客户端") '找到窗口
Debug.Print winHwnd '用来调试 在立即窗口中输入winhnd


RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&) '关闭窗口
Sleep 10000
Dim abc
abc = Shell("C:\Program Files\racer-han-cnc\racer.exe", 1)

End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Sleep 10000
Dim vDoc, vTag
Dim i As Integer

Set vDoc = WebBrowser1.Document
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "text" Or vTag.Type = "password" Then
ElseIf vTag.Type = "button" Then
vTag.Click
End If
End If
Next i
End Sub



要求是这段
Private Sub Command1_Click()

Sleep 18000000
Dim winHwnd As Long
Dim RetVal As Long
winHwnd = FindWindow(vbNullString, "河南网通宽带用户客户端") '找到窗口
Debug.Print winHwnd '用来调试 在立即窗口中输入winhnd


RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&) '关闭窗口
Sleep 10000
Dim abc
abc = Shell("C:\Program Files\racer-han-cnc\racer.exe", 1)

End Sub

循环直到程序退出~



2007-07-09 17:56
a6408425
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-7-9
收藏
得分:0 
顶上来..有人会没,
2007-07-09 19:57
九月
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-6-18
收藏
得分:0 
哪有循环呀
这得延时多长时间啊

2007-07-10 11:29
快速回复:[求助]循环问题大家谁会近来看看~~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038280 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved