[AccessD] VB6 DLL Help Required

Jim DeMarco Jdemarco at hudsonhealthplan.org
Fri Apr 23 07:45:59 CDT 2004


Paul,

I don't know the name of the status event you mention but you could do it a couple of ways.   Yes you could have a form in your dll that appears when status changes (I'm guessing this is the status events use):

<pseudocode>
Private Sub poSendMail_StatusChanged()
  frmStatus.Show
End Sub
</pseudocode>

Or you could add  a Status property and an event to your DLL that wraps the  vbSendMail status event.  This way your app can do whatever it likes with the event

<pseudocode>
Private m_strStatus As String
Public Event EmailStatusChanged

Public Property Get Status() As String
    Status = m_strStatus
End Property

Public Property Let Status(ByVal strStatus As String)
    m_strStatus = strStatus
End Property

Private Sub poSendMail_StatusChanged()
  m_strStatus = SomeValue 'set the Status property in the Changed event
  RaiseEvent EmailStatusChanged 'this is the event you'll trap in your client app
End Sub
</pseudocode>

Now you create an object of your class type in your client app WithEvents:

<pseudocode>
Dim strStatus As String
Private WithEvents myObject as MyDll.cMyClass

private Sub myObject_EmailStatusChanged()
	strStatus = myObject.Status
	'show the status to the user here
End Sub
</pseudocode>

HTH,

Jim DeMarco
Director Application Development
Hudson Health Plan




-----Original Message-----
From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net]
Sent: Friday, April 23, 2004 4:03 AM
To: Access Developers discussion and problem solving
Subject: Re: RE: [AccessD] VB6 DLL Help Required


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
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


 



***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited.  If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message.  Thank You".
***********************************************************************************




More information about the AccessD mailing list