Private Declare Function JMail_DllGetClassObject Lib "JMail.dll" Alias "DllGetClassObject" (rclsid As UUID, riid As UUID, ByRef ppv As Any) As Long
Function CreateJMailMessage() As Object
'这里需要引用Win.tlb类型库
Dim IID_IClassFactory As UUID
Dim IID_IUnknow As UUID
Dim CLSID_Message As UUID
Const CLSIDSTR_Message As String = "{E5FF9F62-0E7C-4372-8AD5-DA7D2418070C}"
CLSIDFromString CLSIDSTR_Message, CLSID_Message
CLSIDFromString IIDSTR_IUnknown, IID_IUnknow
CLSIDFromString IIDSTR_IClassFactory, IID_IClassFactory
Dim ClassFactory As IVBClassFactory
Dim lRet As Long
lRet = JMail_DllGetClassObject(CLSID_Message, IID_IClassFactory, ClassFactory)
Dim MyObject As IUnknown
ClassFactory.CreateInstance Nothing, IID_IUnknow, MyObject
Set ClassFactory = Nothing
Set CreateJMailMessage = MyObject
End Function
Private Sub Command1_Click()
Dim JMailMessage As Object
Set JMailMessage = CreateJMailMessage
MsgBox JMailMessage.About
End Sub
posted on 2010-11-07 10:12
张志松 阅读(3511)
评论(1) 编辑 收藏 引用