Re: Dictionary Object and FSO versions

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Stan Hilliard (usenetreplyMS_at_samplingplansNOTSPAM.com)
Date: 09/06/04


Date: Sun, 05 Sep 2004 23:32:47 -0500

On Sun, 5 Sep 2004 23:42:02 +0200, "Schmidt" <sss@online.de> wrote:

>
>"Stan Hilliard" <usenetreplyMS@samplingplansNOTSPAM.com> schrieb im
>Newsbeitrag news:e7omj09e1jlib0mhmhpfa9coeapn2961vk@4ax.com...
>
>> I want my application to run on windows 9x, ME, NT4, 2000, and XP. The
>> dictionary object is central to the operation of my application and it
>> would be very hard to change at this late date.
>
>I've written a nearly compatible replacement, wich is faster than the
>MS-Dictionary in all disciplines (Add, Remove, KeyAccess, IndexedAccess).
>It allows own Collection-Wrappers because of an implemented
>IEnumVariant-Interface and has no dependencies (VB6-Runtime only).
>
>www.datenhaus.de/Downloads/dh_dic.zip
>
>Olaf

How does your DLL differ from these methods:

'1 add string variable to dictionary with string key.
    oDic.Add "DCODE$", DCODE$

'2 assign value to string variable from dictionary
    ICODE$ = oDic("ICODE$")

'3 empty the dictionary.
    oDic.RemoveAll

'4 test for existence of string key.
    oDic.Exists("DCODE$")

'5 Retrieve item values and keys into a variant array.
    arrItems()=oDic.Items
    arrKeys()=oDic.Keys

'6 Or:
    Dim key as Variant
    For each key in oDic.keys 'For each...next
        debug.print oDic(key)
    Next

My application contains this kind of code:

Public oDic As Scripting.Dictionary
Public oC As CDictionary 'My CDictionary.cls

' In CDictionary.cls
Option Explicit
Public oDic As Scripting.Dictionary
Friend Sub StartDictionary()
    Set oDic = New Scripting.Dictionary
End Sub

' Instantiate the CDictionary dictionary.
    Dim oC As CDictionary
    Set oC = New CDictionary
    Call oC.StartDictionary

' establish reference to dictionary from other module.
    Dim oDic As Dictionary
    Set oDic = oC.oDic

I have downloaded your zip. I have never built a dll and do not know
what the .TLB is about -- except that it is a Remote Automation OLE
TypeLiB file, which I do not understand. Do I still have to register
the dll with regsvr32?

Does this dictionary run in-process?

The dh_Dic.dll (36K) is small compared to the two EXE files (665+661
=1,326K) that I just learned that I have to distribute for scrrun.dll.
http://www.jrsoftware.org/iskb.php?wscript

Do you make the source code available?

Stan Hilliard



Relevant Pages

  • Re: Dictionary Object and FSO versions
    ... It doesn't differ. ... It's just marginally faster if you have LOTS of items. ... > '1 add string variable to dictionary with string key. ... > Dim oC As CDictionary ...
    (microsoft.public.vb.general.discussion)
  • Re: Dictionary Object and FSO versions
    ... >> '1 add string variable to dictionary with string key. ... >> Dim key as Variant ... >and are not needed for VB-Projects, when a dll with the same interface is ... >You only have to register the dll. ...
    (microsoft.public.vb.general.discussion)
  • Unable to Find Entry Point Named XXXXX
    ... I have a function in a native DLL declared as follows: ... public static extern int Startstring Key); ...
    (microsoft.public.dotnet.framework.interop)