16-12-24, 10:45 AM
مرحبا
اريد طريقة الصحيحه لإستدعاء Function من DLL في فيجول بيسك 6
وتم تسجيل ملف DLL و إختياره من قائمة References
ملف DLL من نوع VB.Net
إسم مشؤوع VB.Net :
Email
إسم الكلاس :
SendEmail
إسم Function :
Send
هذا كود فيجول بيسك 6
-----------------------------------------------------
Private Sub Command1_Click()
' On Error GoTo ErrorHandler
Dim Mail As Object
Set Mail = CreateObject("Email.SendEmail")
If Mail Is Nothing Then
MsgBox "Failed to create object. Ensure DLL is registered correctly.", vbCritical, "Error"
Exit Sub
End If
Dim success As Boolean
success = Mail.Send("smtp-mail.outlook.com", 587, True, _
"your_email@outlook.com", "your_password", _
"your_email@outlook.com", "recipient_email@yahoo.com", _
"Test Subject", "Test Body", True)
If success Then
MsgBox "Email sent successfully!", vbInformation, "Success"
Else
MsgBox "Failed to send email!", vbCritical, "Error"
End If
Set Mail = Nothing
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Number & " - " & Err.Description, vbCritical, "Error"
Set Mail = Nothing
End Sub
----------------------------------------------------
يعطيني خطأ على السطر : Set Mail = CreateObject("Email.SendEmail")
ونص الخطأ التالي : 429: ActiveX component can't create object
اريد طريقة الصحيحه لإستدعاء Function من DLL في فيجول بيسك 6
وتم تسجيل ملف DLL و إختياره من قائمة References
ملف DLL من نوع VB.Net
إسم مشؤوع VB.Net :
إسم الكلاس :
SendEmail
إسم Function :
Send
هذا كود فيجول بيسك 6
-----------------------------------------------------
Private Sub Command1_Click()
' On Error GoTo ErrorHandler
Dim Mail As Object
Set Mail = CreateObject("Email.SendEmail")
If Mail Is Nothing Then
MsgBox "Failed to create object. Ensure DLL is registered correctly.", vbCritical, "Error"
Exit Sub
End If
Dim success As Boolean
success = Mail.Send("smtp-mail.outlook.com", 587, True, _
"your_email@outlook.com", "your_password", _
"your_email@outlook.com", "recipient_email@yahoo.com", _
"Test Subject", "Test Body", True)
If success Then
MsgBox "Email sent successfully!", vbInformation, "Success"
Else
MsgBox "Failed to send email!", vbCritical, "Error"
End If
Set Mail = Nothing
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Number & " - " & Err.Description, vbCritical, "Error"
Set Mail = Nothing
End Sub
----------------------------------------------------
يعطيني خطأ على السطر : Set Mail = CreateObject("Email.SendEmail")
ونص الخطأ التالي : 429: ActiveX component can't create object
