张志松
记录工作点滴,留下人生轨迹。(zezese@163.com)
posts - 68,  comments - 11,  trackbacks - 0

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)  编辑 收藏 引用

FeedBack:
# re: VB调用JMail发邮件(无需注册JMail.dll)
2013-04-01 17:51 | 胡水丽
还不错  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理



<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用链接

留言簿(2)

随笔分类

随笔档案

文章分类

文章档案

转载

搜索

  •  

最新评论

阅读排行榜

评论排行榜