Exposing UDT's outside of an activex dll 
Author Message
 Exposing UDT's outside of an activex dll

How do I expose a UDT in my ActiveX DLL to be
available in a client EXE ?

Thanks



Sun, 25 May 2003 03:00:00 GMT  
 Exposing UDT's outside of an activex dll
One way is... not to use a UDT at all... Instead add a PublicNotCreatable
class module and define the public properties the same as the UDT you're
using

'========================
Form1 code
'========================
Option Explicit

Private Sub Form_Load()
   Dim obj As Class1
   Set obj = New Class1
   With obj.UDT
      Debug.Print .UDTElement1
      Debug.Print .UDTElement2
      Debug.Print .UDTElement3
   End With
End Sub

'========================
Class1 code (Main body of dll) (Instancing:MultiUse)
'========================
Option Explicit

Public UDT As clsUDT

Private Sub Class_Initialize()
   Set UDT = New clsUDT
   UDT.UDTElement1 = "sdf"
   UDT.UDTElement2 = 1
   UDT.UDTElement3 = 4
End Sub

Private Sub Class_Terminate()
   Set UDT = Nothing
End Sub

'========================
clsUDT code... your UDT (Instancing:PublicNotCreatable)
'========================
Option Explicit

Public UDTElement1 As String 'These become elements of the UDT
Public UDTElement2 As Integer
Public UDTElement3 As Double
'========================


Quote:
> How do I expose a UDT in my ActiveX DLL to be
> available in a client EXE ?

> Thanks



Sun, 25 May 2003 03:00:00 GMT  
 Exposing UDT's outside of an activex dll
Don't

Your best bet is to create a public not creatable class and expose that
instead of a UDT (they're almost the same anyway)

The problem with UDT's is some versions of the OLE libraries don't support
them as public elements properly. You get really weird errors when it
happens and it's generally shear hell to debug.

Use a plain array or a class, and just skip the UDT's


Quote:
> How do I expose a UDT in my ActiveX DLL to be
> available in a client EXE ?

> Thanks



Sat, 09 Aug 2003 12:21:03 GMT  
 Exposing UDT's outside of an activex dll

Quote:
> Don't

> Your best bet is to create a public not creatable class and expose that
> instead of a UDT (they're almost the same anyway)

they are absolutely NOT the same

Quote:

> The problem with UDT's is some versions of the OLE libraries don't support
> them as public elements properly. You get really weird errors when it
> happens and it's generally shear hell to debug.

only really "old" OS's have the problem (win95, NT4 <SP4)

there are updates for that problem (e.g. DCOM95 1.2)

if u have IE5 installed or MDAC 2.x everything is ok

Quote:
> Use a plain array or a class, and just skip the UDT's



Sat, 09 Aug 2003 18:51:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Exposing UDT's outside of an activex dll

2. UDT's and DLL's

3. Exposing constants from ActiveX DLL

4. Exposing constants on ActiveX dll

5. Exposing constants from a Class or ActiveX DLL

6. What's the differance between a ActiveX.dll and regular dll's

7. Using Module functions inside/outside VB ActiveX DLL

8. VB5 UDT and DLL's

9. wab32.dll exporting or exposing dll

10. ActiveX DLL events won't fire when DLL shows Modal Form

11. 'DoEvents' inside ActiveX DLL

12. ActiveX dll's and EXE's

 

 
Powered by phpBB® Forum Software