From: W. B. / F. N. <wi...@fa...> - 2004-02-16 17:01:18
|
Looks okay to me :-) Though I think we should take out the object =3D Nothing code too, as = Windows will handle it for us when terminating the program; it saves = some speed too, although it will require a bit more memory to run (just = some pointer space, nothing big). If you really want to make the string comparisions fast, you'd better = check the size of the string from memory as the only things that are = beeing checked at the moment are if a string contains something. Just = peek the size of the string, directly before the string in memory. Wimz ----- Original Message -----=20 From: Darko Kenda=20 To: cb...@li...=20 Sent: Monday, February 16, 2004 4:29 PM Subject: RE: [Cbm-cvs] Preview-Source : modLoader.BAS [CodeBlue/IM = Loader] Hello all... I made some minor modifications to loader code.. =20 Darko =20 =20 =20 = '------------------------------------------------------------------------= ------------- ' CodeBlue/IM Modular Loader v1.0 ' ' Date Coder Description ' =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ' 02-14-04 Wimz Initial Creation ' 02-16-04 Darko Some performance tweaks ' ' ' ' Modular loader for CodeBlue/IM ' ' Checks for updates of the CodeBlue/IM components at startup, = downloads and installs ' updates if available and launches the program afterwards. Using = modular code, we ' can save loads of time and effort telling everyone there's a new = update to be ' downloaded, especially while still in heavy development. ' = '------------------------------------------------------------------------= ------------- =20 Option Explicit 'We have to declare every variable Option Compare Text 'Default compare option is now text (not case = sensitive) instead of binary =20 Private Sub Main() '--[ Variable declaration = ]--------------------------------------------------- Dim szErrMissingMSG As String Dim szErrMissingTtl As String =20 '--[ Display the form = ]------------------------------------------------------- frmSplash.Show =20 '--[ Setup basic error handeling = ]-------------------------------------------- On Error Resume Next =20 '--[ Load Localised Messages = ]------------------------------------------------ szErrMissingMSG =3D VB.LoadResString(1900) szErrMissingTtl =3D VB.LoadResString(1901) =20 '--[ Catch Localisation Errors = ]---------------------------------------------- If LenB(szErrMissingMSG) =3D 0 Then 'Note that LenB() is = faster for checking if variable is empty szErrMissingTtl =3D "CodeBlue/IM - Critical Error" szErrMissingMSG =3D "Core components could not be found; = please re-install" + vbNewLine + _ " CodeBlue/IM. CodeBlue/IM will now be = terminated." End If =20 '--[ Check if components exist = ]---------------------------------------------- If LenB(FileSystem.Dir(App.Path & "\" & "cbupwiz.dll")) =3D 0 = Or _ LenB(FileSystem.Dir(App.Path & "\" & "cbimapi.dll")) =3D 0 = Then ' --[ Display error & Exit = ]------------------------------------------ MsgBox szErrMissingMSG, vbCritical, szErrMissingTtl End End If =20 '--[ Check for updates = ]------------------------------------------------------ Dim ctlCBWUD As Object Set ctlCBWUD =3D CreateObject("CBUpWiz.modUpdate") If ctlCBWUD.StartUpdate =3D True Then End End If Set ctlCBWUD =3D Nothing =20 '--[ Start CodeBlue Messenger = ]----------------------------------------------- Dim ctlCBAPI As Object Set ctlCBAPI =3D CreateObject("CBIMApi.CodeBlue") frmSplash.Hide ctlCBAPI.StartUp Set ctlCBAPI =3D Nothing =20 '--[ Exit to Windows = ]-------------------------------------------------------- End End Sub |