Outlook Addin.

  • Thread starter Thread starter Posh
  • Start date Start date
P

Posh

Hi

I was wondering if someone could help me.

I have a Dll that i set up as trusted code which sends an
email when a button is pressed as i wanted to test that i
could get the trusted code to work. I got it to work and
when you press the button to send a mail those annoying
prompts dont popup.

But what i wanted to know is does anyone know how to hook
into the trusted Dll from VB6 so that an external
executable can use it. As this is how we need it to work
we have a executable that sends mail so what we wanted was
to setup a Dll and trust it and hook into this Dll from
the executalbe and call routines to send the mail from
there.

Has anyone done this ?
 
You can pass the Application object that you got in the OnConnction event to
your externall dll/exe.

Mike
 
Actually, the Application object wouldn't do you any good since it's
the standard Outlook application object.

The way I communicate with a COM addin DLL from the property page
(OCX) or an external application is to expose a public class in my
addin designer. The class is defined and instantiated when the addin
starts up and an exposed hook to it is in the designer. So from other
programs I can get the addin I want from the COMAddins collection, get
its Object property and from there hook into the class and use its
methods or properties.

Here's how it looks:
'in designer, with extra stuff removed
Public moPublicClass As clsPublicClass

Private Sub IDTExtensibility2_OnConnection(ByVal Application As
Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)

On Error Resume Next

If Application.Explorers.Count > 0 Then
'AddInInst represents COMAddIn object
AddInInst.Object = Me
Set moPublicClass = New clsPublicClass

'Create and Initialize a base class
gBaseClass.InitHandler Application, AddInInst.ProgId

End If
End Sub

Public Property Get PPClass() As clsPublicClass
On Error Resume Next

If moPublicClass Is Nothing Then
Set moPublicClass = New clsPublicClass
End If
Set PPClass = moPublicClass
End Property

'clsPublicClass definition has exposed propties and methods

'In calling code:
Private m_oAddinBase As Object
Private m_oAddinSecond As Object

Sub Whatever()
Dim objOL As Outlook.Application

Set objOL = CreateObject("Outlook.Application")
Set m_oAddinBase = objOL.COMAddIns("MyAddin.Connect").Object
If Not (m_oAddinBase Is Nothing) Then
Set m_oAddinSecond = m_oAddinBase.PPClass
End If

'call a method or property in the addin
m_oAddinSecond.MyMethod()
'or
myProp = m_oAddinSecond.PropGet
'or
m_oAddinSecond.PropLet = myVariable
'and so on
 
Hi Ken,

Thanks for your reply.


Where does the code below come from what is the gbaseClass
as i am not sure about this ???
'Create and Initialize a base class
gBaseClass.InitHandler Application,
AddInInst.ProgIdwondering if you could tell me where the

Thanks in advance
Ave,
-----Original Message-----
Actually, the Application object wouldn't do you any good since it's
the standard Outlook application object.

The way I communicate with a COM addin DLL from the property page
(OCX) or an external application is to expose a public class in my
addin designer. The class is defined and instantiated when the addin
starts up and an exposed hook to it is in the designer. So from other
programs I can get the addin I want from the COMAddins collection, get
its Object property and from there hook into the class and use its
methods or properties.

Here's how it looks:
'in designer, with extra stuff removed
Public moPublicClass As clsPublicClass

Private Sub IDTExtensibility2_OnConnection(ByVal Application As
Object, _
ByVal ConnectMode As
AddInDesignerObjects.ext_ConnectMode, _
 
Look at Randy Byrne's ItemsCB COM addin sample on the Resources page
at www.microeye.com It has that gbaseclass and also shows many best
practices for Outlook addins. The communication between an addin and a
property page or external app isn't shown in there.
 
Back
Top