向网页 定时发送消息 用vb如何实现?

yelang771 2008-04-10 01:42:47
rt
怎样实现发送消息到网页上,比如我现在发的这个帖子里..
用什么控件,怎样实现.
...全文
110 点赞 收藏 16
写回复
16 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
camel78 2008-05-09
不定时上论坛解答问题。
定时部分用Timmer就不说了,发送部分
1:用异步下载方式
Dim oADL As AsyncDownload
oADL.Download URL, , , "Post", , "UserName=uname&PWD=password"
2:用WebBrowser控件
'赋值
WebBrowser1.Document.All.UserName.Value = "uname"
WebBrowser1.Document.All.PWD.Value = "password"
'提交
Private Sub cmd点击注册帐号提交_Click()
On Error Resume Next
'对于没有Name的没找到好方法,只能用这种笨方法,你有如好的方法可告诉我:)
Dim i As Integer
Dim j As Integer
For i = 0 To Val(WebBrowser1.Document.All.length - 1)
If WebBrowser1.Document.All.Item(i).Name <> "login" Then
Else
j = i
Exit For
End If
Next
WebBrowser1.Document.All.Item(i).Click
End Sub
回复
lyserver 2008-05-09
我写了一个定时向所有IE窗口写时间的程序,LZ可在此基础上进一步发挥。
类模块:clsIE.cls
Option Explicit

Public Event NewWindow(Cancel As Boolean)
Public Event Quit()
Public Event BeforeNavigate(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
Public Event DocumentComplete(ByVal pDisp As Object, URL As Variant)

Public WithEvents IE As InternetExplorer

Dim WithEvents MyTimer As Timer
Dim m_lCookie As Long

Private Sub Class_Terminate()
On Error Resume Next
MyTimer.Enabled = False
Form1.Controls.Remove ("VB.Timer" & CStr(lCookie))
Set IE = Nothing
End Sub

Public Property Let lCookie(ByVal lNewCookie As Long)
m_lCookie = lNewCookie
Set MyTimer = Form1.Controls.Add("VB.Timer", "MyTimer" & CStr(m_lCookie))
MyTimer.Interval = 1000
MyTimer.Enabled = True
End Property

Public Property Get lCookie() As Long
lCookie = m_lCookie
End Property

Public Sub IE_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
RaiseEvent BeforeNavigate(pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel)
MyTimer.Enabled = False
End Sub

Public Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
RaiseEvent DocumentComplete(pDisp, URL)
If IE.Busy = False Then
MyTimer.Enabled = True
End If
End Sub

Public Sub IE_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim m_Cancel As Boolean
RaiseEvent NewWindow(m_Cancel)
cancle = m_Cancel
End Sub

Public Sub IE_OnQuit()
RaiseEvent Quit
End Sub

Private Sub MyTimer_Timer()
Dim i As Integer
Dim Body As Object
Dim MyElement As Object

On Error Resume Next
Set Body = IE.document.Body
Set MyElement = IE.document.getElementById("MyTimeLable")
If TypeName(MyElement) <> "Nothing" Then
MyElement.innerHTML = "<span id=" & Chr(34) & "MyTimeLable" & Chr(34) & ">当前时间:" & Time() & "</span>"
ElseIf TypeName(Body) <> "Nothing" Then
Body.innerHTML = "<span id=" & Chr(34) & "MyTimeLable" & Chr(34) & ">当前时间:" & Time() & "</span></p>" & Body.innerHTML
End If
Err.Clear
End Sub
窗口模块:Form1.frm
Option Explicit

Dim WithEvents Shl As ShellWindows
Dim IEMonitor() As clsIE
Dim IE_Count As Integer

Private Sub Form_Load()
Dim i As Integer

ReDim IEMonitor(0)
Set Shl = New ShellWindows
IE_Count = 0

For i = 0 To Shl.Count - 1
If TypeName(Shl.Item(i)) = "IWebBrowser2" Then
ReDim Preserve IEMonitor(IE_Count)
Set IEMonitor(IE_Count) = New clsIE
Set IEMonitor(IE_Count).IE = Shl.Item(i)
IEMonitor(IE_Count).lCookie = i
IE_Count = IE_Count + 1
End If
Next
End Sub

Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
For i = 0 To IE_Count - 1
Set IEMonitor(i) = Nothing
Next
Set Shl = Nothing
End Sub

Private Sub Shl_WindowRegistered(ByVal lCookie As Long)
If TypeName(Shl.Item(Shl.Count - 1)) = "IWebBrowser2" Then
ReDim Preserve IEMonitor(IE_Count)
Set IEMonitor(IE_Count) = New clsIE
Set IEMonitor(IE_Count).IE = Shl.Item(Shl.Count - 1)
IEMonitor(IE_Count).lCookie = lCookie
IE_Count = IE_Count + 1
End If
End Sub

Private Sub Shl_WindowRevoked(ByVal lCookie As Long)
Dim i As Integer, j As Integer
For i = 0 To IE_Count - 1
If lCookie = IEMonitor(i).lCookie Then
For j = i + 1 To IE_Count - 1
Set IEMonitor(j - 1) = IEMonitor(j)
Next
IE_Count = IE_Count - 1
Set IEMonitor(IE_Count) = Nothing
ReDim Preserve IEMonitor(IE_Count)
End If
Next
End Sub
回复
yinweihong 2008-05-08
哎,又是一个机器人~!!!!
回复
yelang771 2008-05-08
不要验证的,我可以自己先登陆进来,在自动发送.

说给我听听

表说很简单,我搞不定~
回复
关键是你要自动发帖子么?现在很多论坛都有验证功能了。所以分析验证图片很麻烦。如果不用验证功能。用很多控件都能实现。
回复
lyserver 2008-05-08
截获浏览器,很简单.
回复
forbearORfolie 2008-05-08
jf
回复
yelang771 2008-05-08
在顶一次~~
回复
yelang771 2008-05-07
弄不好,在顶上来~
回复
meiZiNick 2008-05-01
lz要干嘛?
回复
有点难度哦
回复
UltraBejing 2008-04-30
我也想知道,正在找這方面的資料~~~~~
回复
yelang771 2008-04-10
谢谢楼上的 回家研究~~
回复
CathySun118 2008-04-10
http://www.cnblogs.com/wddavid/archive/2005/06/19/176978.html
回复
POST 数据包
回复
用IWebBrowser2
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7492

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2008-04-10 01:42
社区公告
暂无公告