|
-
October 28th, 1999, 02:12 PM
#1
Ping - Error - Object required
I am trying to ping a server if it fails i have to send a mail to a bunch of people. I created an object for class clsSendMail but when I try sending a message to the Mail server it gives me an error object required RUN time error - 424.
Thanks.
-
October 28th, 1999, 02:16 PM
#2
Re: Ping - Error - Object required
What clsSendMail are you using? Try this one:
http://www.freevbcode.com/ShowCode.Asp?ID=109.
-
October 28th, 1999, 02:25 PM
#3
Re: Ping - Error - Object required
I am using the same code but when I give
Private WithEvents poSendMail as SendMail.clsSendMail
it gives me Compile error: User-defined type not defined.
Thanks!
Garry
-
October 28th, 1999, 02:41 PM
#4
Re: Ping - Error - Object required
You must have a reference to the SendMail.dll in your project.
From the Project Menu, choose references. If you don't see the dll in the list of avaiable references, browse to the directory where you downloaded it, and select it.
-
October 28th, 1999, 04:09 PM
#5
Re: Ping - Error - Object required
Garry:
Like yourself, I'm working on some code which will allow me to ping a server. I'm not really interested in the email part of the code, but is there any chance I could see the VB code which allows you to ping? I'm having a hard time making this work and would be very grateful for the knowledge.
Sincerely,
Matthew
-
October 28th, 1999, 05:26 PM
#6
Re: Ping - Error - Object required
-
October 29th, 1999, 08:30 AM
#7
Re: Ping - Error - Object required
Hi Matthew!
Did you get it to work. Sorry I could not reply to you earlier I had left by the time you posted and could not get back until today. Do you still want the code? I can give you. It is different than one posted by czimmerman.
I added the references but I still have the same problem Object required- Run Time Error- 424.
Private Sub address_Change()
End Sub
Private Sub Command1_Click()
Dim sIPAddress As String
Dim sReturnMsg As String
sIPAddress = "193.41.112.60"
If Not Ping(sIPAddress, sReturnMsg) = 0 Then
MsgBox "Ping failed. Return message: " & sReturnMsg
Else
MsgBox "Ping successful. Return message: " & sReturnMsg
End If
End Sub
Private Sub Command2_Click()
Dim sIPAddress As String
Dim sReturnMsg As String
sIPAddress = "193.43.55.247"
If Not Ping(sIPAddress, sReturnMsg) = 0 Then
MsgBox "Ping failed. Return message: " & sReturnMsg
Else
MsgBox "Ping successful. Return message: " & sReturnMsg
End If
End Sub
Private Sub Timer1_Timer()
Dim jsIPAddress As String
Dim jsReturnMsg As String
Dim lsIPAddress As String
Dim lsReturnMsg As String
Dim gsIPAddress As String
Dim gsReturnMsg As String
Dim ssIPAddress As String
Dim ssReturnMsg As String
lsIPAddress = "WK2"
If Not Ping(lsIPAddress, lsReturnMsg) = 0 Then
MsgBox "Ping failed for EC1. Return message: " & lsReturnMsg
Else
'MsgBox "Ping successful for EC1. Return message: " & lsReturnMsg
poSendMail.SMTPHost = "POBOX.com"
poSendMail.From = "[email protected]"
poSendMail.FromDisplayName = "EC1"
poSendMail.Recipient = "[email protected]"
poSendMail.RecipientDisplayName = "gb"
'poSendMail.ReplyToAddress = txtFrom.Text
poSendMail.Subject = "Ping_failed!"
poSendMail.Message = "Ping to ec1 has failed please check the server"
'poSendMail.Attachment = Trim(txtAttach.Text)
poSendMail.Send
End If
jIPAddress = "WK36"
If Not Ping(jsIPAddress, jsReturnMsg) = 0 Then
MsgBox "Ping failed for JEC1. Return message: " & jsReturnMsg
Else
MsgBox "Ping successful for JEC1. Return message: " & jsReturnMsg
End If
gsIPAddress = "WKB1"
If Not Ping(gsIPAddress, gsReturnMsg) = 0 Then
MsgBox "Ping failed for GREC1. Return message: " & gsReturnMsg
Else
MsgBox "Ping successful for GREC1. Return message: " & gsReturnMsg
End If
ssIPAddress = "WK81"
If Not Ping(ssIPAddress, ssReturnMsg) = 0 Then
MsgBox "Ping failed for SAEC1. Return message: " & ssReturnMsg
Else
MsgBox "Ping successful for SAEC1. Return message: " & ssReturnMsg
End If
End Sub
Private Sub Form_Initialize()
Set poSendMail = New clsSendMail
End Sub
-
October 29th, 1999, 11:45 AM
#8
Re: Ping - Error - Object required
Wow! Many, many thanks for the code! I was in class until 11pm last night and just got time today to have a look your code. It looks wonderful. I don't see anywhere in your code where you are directly accessing a COM port or modem- is that done automatically by the "ping" function?
Sincerely,
Matthew
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|