' *************************************************** ' ' IDSMINIT.BAS ' ' This module contains a VB3 function for initializing ' IDSMail with error handling. This overcomes problems ' related to VB3's older OLE implementation. ' ' Copyright 1995 ' By Intuitive Data Solutions ' ' *************************************************** Declare Function GetTickCountIDS& Lib "user" Alias "GetTickCount" () Function StartIDSMailServer%() ' VB3 can be slow to load OLE DLL's, causing ' the initial creation of OLE servers to fail. ' This routine handles these errors by trying ' to load the server again after a delay. ' Note that idsMail must be declared as a ' module-level or global variable (VB doesn't ' let you pass object variables to be set in ' a function). On Error GoTo StartIDSMailServerHandler Set idsMail = CreateObject("IDSMailInterface.Server") StartIDSMailServer% = True StartIDSMailServerExit: Exit Function StartIDSMailServerHandler: errCount% = errCount% + 1 If errCount% < 5 Then startTick& = GetTickCountIDS&() Do DoEvents deltaTicks& = GetTickCountIDS&() - startTick& Loop Until deltaTicks& > 500 Resume Else StartIDSMailServer% = Err Resume StartIDSMailServerExit End If End Function