If msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE Then
Timer2.Enabled = True
Timer1.Enabled = False
Else
msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE
End If
7.Double click timer 2 and add this:
If msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE Then
msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_INVISIBLE
Timer1.Enabled = True
Timer2.Enabled = False
Else
msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_INVISIBLE
End If
8. Finally it should look like this:
Public Class Form1
Private WithEvents ni As New NotifyIcon
Dim msn As New MessengerAPI.Messenger
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
Timer1****terval = (TextBox1.Text)
Timer2****terval = (TextBox1.Text)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
Timer2.Enabled = False
msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE Then
Timer2.Enabled = True
Timer1.Enabled = False
Else
msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_ONLINE Then
msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_INVISIBLE
Timer1.Enabled = True
Timer2.Enabled = False
Else
msn.MyStatus = MessengerAPI.MISTATUS.MISTATUS_INVISIBLE
End If
End Sub
End Class
I get the error: for the code of line dim msn as new messengerapi.messenger
Code:
Creating an instance of the COM component with CLSID {B69003B3-C55E-4B48-836C-BC5946FC3B28} from the IClassFactory failed due to the following error: 8007000e.