我正在尝试创建一个 yahoo messenger 自动回复应用程序。如果我使用按钮来检索它,我可以检索新消息,但是如果我使用计时器来获取新消息,它会向我显示带有额外标记的新消息。这是错误。
这是代码:
Private Sub Pause(ByVal seconds As Integer)
Dim current As Date
current = DateTime.Now
Do While (DateTime.Now - current).TotalSeconds < seconds
Application.DoEvents()
Threading.Thread.Sleep(1000)
Loop
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim keyword As String = ""
Dim arrKeyword() As String
Dim param As String = ""
ymVersion = getYMVersion()
Select Case ymVersion
Case "8"
hwndYMMainClass = FindWindow("YSearchMenuWndClass", vbNullString)
Case "9"
hwndYMMainClass = FindWindow("ATL:007C07F0", vbNullString)
Case "10"
hwndYMMainClass = FindWindow("CConvWndBase", vbNullString)
End Select
If hwndYMMainClass <> 0 Then
pause(1)
ymid = getYMID(hwndYMMainClass)
msg = getYMMessage(hwndYMMainClass)
lstBox.Items.Add(ymid + "-" + msg)
ymChatSend(hwndYMMainClass, "Telah terima")
closeYM(hwndYMMainClass)
End If
End Sub
顺便说一句,我使用了一个间隔为 500 的计时器。哪里是显示额外的错误 - 不是应该的?谢谢