[AccessD] CreateObject class names

Ryan W wrwehler at gmail.com
Fri Oct 28 17:32:17 CDT 2022


Stuart,

Thanks. Yes naturally the libraries accessible to me locally. 

References gives me a long descriptive name, unfortunately I don’t believe that works with createobject. 

I did find the ProgID buried in the registry, I just was wondering if there was a better way. 

Sounds like adding the reference and using the object browser is the most simple.

I’ve had this come up before where I needed to use late binding to avoid the issues with missing references when distributing the FE. In a prior case where we run our software but a couple users have forms to manipulate and read in a specific excel worksheet and some machines don’t have excel (or use those forms). 



Sent from my iPhone

> On Oct 28, 2022, at 4:01 PM, Stuart McLachlan <stuart at lexacorp.com.pg> wrote:
> 
> On 28 Oct 2022 at 10:26, Ryan W wrote:
> 
>> Aside from Google, is there some way to find the class names when
>> using CreateObject.
>> 
>> eg:
>> 
>> dim re as Object
>> set re = CreateObect("vbscript.regexp") <-- found via google
>> 
> 
> There is a potentially infinite number of class names.
> 
> If you mean "find the class names of COM libraries that are registered on your PC", then 
> there are tools available.
> 
> Tools-References lists the registered libraries on you PC including "Microsoft VBScript 
> Regular Expressions 5.5"
> 
> If you want to use CreateObject() rather than just ticking that reference, then you could 
> search the registry for the Descriptive name
> 
> You will find it under a GUID
> HKCR\TypeLib\{3F4DACA7-160D-11D2-A8E9-00104B365C9F}\5.5
> 
> Then search HKCR\CLID for that GUID and look at the ProgID sub-key..
> [HKEY_CLASSES_ROOT\CLSID\{3F4DACA4-160D-11D2-A8E9-00104B365C9F}\ProgID] 
> ="VBScript.RegExp"
> 
> I've got a tool that locates all registered 32 Bit libraries. It creates appropriate incl files for 
> PowerBASIC. (Where there are 32 bit and 64 bit versions of the type libraries, generally the 
> only difference is the location of the file (System32 or SysWow64)
> 
> Here's the one for RegExpr The relevant line you are asking for is:
> ' Version Dependent ProgIDs
> $PROGID_VBScript_RegExp_55_RegExpRegExp = "VBScript.RegExp"
> 
> Note that it also lists the properties and methods of the object
> 
> ' Generated by: PowerBASIC COM Browser v.2.00.0086
> ' Date & Time : 29/10/2022 at 6:41 AM
> ' Options:
> ' Always use an Interface Prefix : Off
> ' Interface Prefix               : Int_
> ' Prefix ProgIDs, ClassIDs...    : On
> ' Use ANSI Strings               : Off
> ' Use Singular Enumerations      : Off
> ' Generate Dispatch Interfaces   : Off
> ' Include Parameter Names        : On
> ' Use Property Get/Set statements: On
> ' ------------------------------------------------
> ' Library Name: VBScript_RegExp_55
> ' Library File: C:\Windows\SysWOW64\vbscript.dll\3
> ' Description : Microsoft VBScript Regular Expressions 5.5
> ' GUID : {3F4DACA7-160D-11D2-A8E9-00104B365C9F}
> ' LCID : 0
> ' Version : 5.5
> 
> ' Version Dependent ProgIDs
> $PROGID_VBScript_RegExp_55_RegExpRegExp = "VBScript.RegExp"
> 
> ' Class Identifiers
> $CLSID_VBScript_RegExp_55_RegExp = 
> GUID$("{3F4DACA4-160D-11D2-A8E9-00104B365C9F}")
> $CLSID_VBScript_RegExp_55_Match = 
> GUID$("{3F4DACA5-160D-11D2-A8E9-00104B365C9F}")
> $CLSID_VBScript_RegExp_55_MatchCollection = 
> GUID$("{3F4DACA6-160D-11D2-A8E9-00104B365C9F}")
> $CLSID_VBScript_RegExp_55_SubMatches = 
> GUID$("{3F4DACC0-160D-11D2-A8E9-00104B365C9F}")
> 
> ' Interface Identifiers
> $IID_VBScript_RegExp_55_IRegExp = 
> GUID$("{3F4DACA0-160D-11D2-A8E9-00104B365C9F}")
> $IID_VBScript_RegExp_55_IMatch = 
> GUID$("{3F4DACA1-160D-11D2-A8E9-00104B365C9F}")
> $IID_VBScript_RegExp_55_IMatchCollection = 
> GUID$("{3F4DACA2-160D-11D2-A8E9-00104B365C9F}")
> $IID_VBScript_RegExp_55_IRegExp2 = 
> GUID$("{3F4DACB0-160D-11D2-A8E9-00104B365C9F}")
> $IID_VBScript_RegExp_55_IMatch2 = 
> GUID$("{3F4DACB1-160D-11D2-A8E9-00104B365C9F}")
> $IID_VBScript_RegExp_55_IMatchCollection2 = 
> GUID$("{3F4DACB2-160D-11D2-A8E9-00104B365C9F}")
> $IID_VBScript_RegExp_55_ISubMatches = 
> GUID$("{3F4DACB3-160D-11D2-A8E9-00104B365C9F}")
> 
> ' Interface Name  : IRegExp
> ' This Interface cannot be created directly it can only
> ' be returned by a Method or Property in this library. 
> Interface IRegExp $IID_VBScript_RegExp_55_IRegExp 
>    Inherit IDispatch
> 
>    Property Get Pattern <10001> () As WString
>    Property Set Pattern <10001> (ByVal pPattern As WString)
>    Property Get IgnoreCase <10002> () As Integer
>    Property Set IgnoreCase <10002> (ByVal pIgnoreCase As Integer)
>    Property Get Global <10003> () As Integer
>    Property Set Global <10003> (ByVal pGlobal As Integer)
>    Method Execute <10004> (Byval sourceString As WString) As IDispatch
>    Method Test <10005> (Byval sourceString As WString) As Integer
>    Method Replace <10006> (Byval sourceString As WString, Byval replaceString As 
> WString) As WString
> End Interface
> 
> ' Interface Name  : IMatch
> ' This Interface cannot be created directly it can only
> ' be returned by a Method or Property in this library. 
> Interface IMatch $IID_VBScript_RegExp_55_IMatch 
>    Inherit IDispatch
> 
>    Property Get Value <0> () As WString
>    Property Get FirstIndex <10001> () As Long
>    Property Get Length <10002> () As Long
> End Interface
> 
> ' Interface Name  : IMatchCollection
> ' This Interface cannot be created directly it can only
> ' be returned by a Method or Property in this library. 
> Interface IMatchCollection $IID_VBScript_RegExp_55_IMatchCollection 
>    Inherit IDispatch
> 
>    Property Get Item <10001> (ByVal index As Long) As IDispatch
>    Property Get Count <1> () As Long
>    Property Get PropGet__NewEnum <-4> () As IUnknown
> End Interface
> 
> ' Interface Name  : IRegExp2
> ' Class Name      : RegExp
> ' ClassID         : $CLSID_VBScript_RegExp_55_RegExp
> ' Version ProgID  : $PROGID_VBScript_RegExp_55_RegExpRegExp
> Interface IRegExp2 $IID_VBScript_RegExp_55_IRegExp2 
>    Inherit IDispatch
> 
>    Property Get Pattern <10001> () As WString
>    Property Set Pattern <10001> (ByVal pPattern As WString)
>    Property Get IgnoreCase <10002> () As Integer
>    Property Set IgnoreCase <10002> (ByVal pIgnoreCase As Integer)
>    Property Get Global <10003> () As Integer
>    Property Set Global <10003> (ByVal pGlobal As Integer)
>    Property Get Multiline <10007> () As Integer
>    Property Set Multiline <10007> (ByVal pMultiline As Integer)
>    Method Execute <10004> (Byval sourceString As WString) As IDispatch
>    Method Test <10005> (Byval sourceString As WString) As Integer
>    Method Replace <10006> (Byval sourceString As WString, Byval replaceVar As Variant) 
> As WString
> End Interface
> 
> ' Interface Name  : IMatch2
> ' Class Name      : Match
> ' ClassID         : $CLSID_VBScript_RegExp_55_Match
> ' This Interface cannot be created directly it can only
> ' be returned by a Method or Property in this library. 
> Interface IMatch2 $IID_VBScript_RegExp_55_IMatch2 
>    Inherit IDispatch
> 
>    Property Get Value <0> () As WString
>    Property Get FirstIndex <10001> () As Long
>    Property Get Length <10002> () As Long
>    Property Get SubMatches <10003> () As IDispatch
> End Interface
> 
> ' Interface Name  : IMatchCollection2
> ' Class Name      : MatchCollection
> ' ClassID         : $CLSID_VBScript_RegExp_55_MatchCollection
> ' This Interface cannot be created directly it can only
> ' be returned by a Method or Property in this library. 
> Interface IMatchCollection2 $IID_VBScript_RegExp_55_IMatchCollection2 
>    Inherit IDispatch
> 
>    Property Get Item <0> (ByVal index As Long) As IDispatch
>    Property Get Count <1> () As Long
>    Property Get PropGet__NewEnum <-4> () As IUnknown
> End Interface
> 
> ' Interface Name  : ISubMatches
> ' Class Name      : SubMatches
> ' ClassID         : $CLSID_VBScript_RegExp_55_SubMatches
> ' This Interface cannot be created directly it can only
> ' be returned by a Method or Property in this library. 
> Interface ISubMatches $IID_VBScript_RegExp_55_ISubMatches 
>    Inherit IDispatch
> 
>    Property Get Item <0> (ByVal index As Long) As Variant
>    Property Get Count <1> () As Long
>    Property Get PropGet__NewEnum <-4> () As IUnknown
> End Interface
> 
> 
> 
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


More information about the AccessD mailing list