[AccessD] VB6 DLL Help Required

paul.hartland at fsmail.net paul.hartland at fsmail.net
Fri Apr 23 03:02:32 CDT 2004


This is the code I used for my DLL (may not be what your expecting as this is my first ever DLL, and I use a reference to another DLL (vbSendMail)
Public WithEvents poSendmail As vbSendMail.clsSendMail
Function SendEmail(EmailFrom As String, EmailTo As String, EmailSub As String, EmailBody As String, EmailAtt As String)
    
    Set poSendmail = New clsSendMail
    
    With poSendmail
        .SMTPHost = "Primary"
        .From = EmailFrom
        .FromDisplayName = EmailFrom
        .ReplyToAddress = EmailFrom
        .Recipient = EmailTo
        .Subject = EmailSub
        .Message = EmailBody
        .Attachment = EmailAtt
        .Send
    End With
    
    Set poSendmail = Nothing
    
End Function
Private Sub poSendmail_SendSuccesful()
    MsgBox "Email has been sent", vbInformation, "**** Email Sent ****"
End Sub
Private Sub poSendmail_SendFailed(Explanation As String)
    MsgBox "Email has NOT been sent for the following reason:" & vbCrLf & vbCrLf & _
                 Explanation, vbInformation, "**** Email Failed ****"
End Sub

The msgbox's work to say if the email has been sent or not, but there is also a status event which really needs to be on a label, but I don't know how to show this to the user.
Paul




Message date : Apr 23 2004, 12:47 AM
>From : "Ken Ismert" 
To : "'Access Developers discussion and problem solving'" 
Copy to : 
Subject : RE: [AccessD] VB6 DLL Help Required

Paul,

Are you using your DLL 'API-style' using Declare statements, or have you
registered it as a COM component, and can create objects you have defined in
your DLL?

If the former, you are limited basically to return codes from your function
call. If the latter, you could define your own events in your vbSendMail
wrapper object to relay the vbSendMail events to your client.

-Ken

-----Original Message-----
From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net]
Sent: Thursday, April 22, 2004 7:11 AM
To: accessd
Subject: [AccessD] VB6 DLL Help Required


To all,

Been playing with creating my own DLL’s today using Visual Basic 6 and I
eventually created one to send an email using the vbSendMail.dll which works
a treat. But now I want to use the withevents part of the vbSendMail.dll
which will return the following:

Email Sent Ok
Email Failed
Email Staus

Can I put a form inside a dll or do I somehow have to return the appropriate
message to the calling application, if so how will I do this, has anyone any
ideas on this?

Paul Hartland
Join the UK's number one for the internet
www.freeserve.com/time

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
Join the UK's number one for the internet 
www.freeserve.com/time


More information about the AccessD mailing list