I am writing a VFP8 application and am automating a
third-party application that offers a COM interface. Unfortunately,
the company that wrote this third-party application does not
have a list of the enumerations used in their system. As a
result, I can only determine enumeration values by using the
VB object browser. This is very tediuous.

Is there a tool around that can extract and print all of the
enumerations in a COM server? I know this could probably be
programmed using TLBINF32.DLL, but I was hoping a freeware tool
already existed that can just be given the name of the COM server
to dump all of the enumerations and their values.

Does such a tool exist?

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

Re: Utility to extract/print all enumerations? by Dan

Dan
Tue Aug 23 15:45:12 CDT 2005

Open the TypeLib in the VFP object browser. Drill down until you see
Enumerations. Drag that node to an empty PRG and you've got it.

Dan

Tim Witort wrote:
> I am writing a VFP8 application and am automating a
> third-party application that offers a COM interface. Unfortunately,
> the company that wrote this third-party application does not
> have a list of the enumerations used in their system. As a
> result, I can only determine enumeration values by using the
> VB object browser. This is very tediuous.
>
> Is there a tool around that can extract and print all of the
> enumerations in a COM server? I know this could probably be
> programmed using TLBINF32.DLL, but I was hoping a freeware tool
> already existed that can just be given the name of the COM server
> to dump all of the enumerations and their values.
>
> Does such a tool exist?
>
> -- TRW
> _______________________________________
> t r w 7
> at
> i x dot n e t c o m dot c o m
> _______________________________________



Re: Utility to extract/print all enumerations? by trw7at

trw7at
Tue Aug 23 19:03:35 CDT 2005


> Tim Witort wrote:
>> I am writing a VFP8 application and am automating a
>> third-party application that offers a COM interface. Unfortunately,
>> the company that wrote this third-party application does not
>> have a list of the enumerations used in their system. As a
>> result, I can only determine enumeration values by using the
>> VB object browser. This is very tediuous.
>>
>> Is there a tool around that can extract and print all of the
>> enumerations in a COM server? I know this could probably be
>> programmed using TLBINF32.DLL, but I was hoping a freeware tool
>> already existed that can just be given the name of the COM server
>> to dump all of the enumerations and their values.
>>
>> Does such a tool exist?
>>
>> -- TRW

Dan Freeman seemed to utter in news:eM92POCqFHA.712@TK2MSFTNGP15.phx.gbl:

> Open the TypeLib in the VFP object browser. Drill down until you see
> Enumerations. Drag that node to an empty PRG and you've got it.
>
> Dan
>

Good tip, Dan! It's a bit tiresome to individually move each
enumeration over to the PRG, but it's better than looking
up *each value* of the enumerations in the VB browser! I don't
suppose there is a way to select multiple enumerations and
drag them all over in one shot, is there? (this COM server
has over 100 enumerations)

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

Re: Utility to extract/print all enumerations? by David

David
Tue Aug 23 19:35:48 CDT 2005

Tim,

I posted this as some ER code a while back.. until it makes it into VFP
there is a way to fix this shortcoming. pull the object browser code out of
the xsource.zip file and make these minor mods:

We can drag the Constants item and get a dump of all the #defines. We can
NOT drag/drop the Enums item and get all of the enums dumped at one time.

In trvHierarchy.OLESetData change this if:

IF Left(THISFORM.odragnode.Text,9) == "Constants" OR
Left(THISFORM.odragnode.Key,7) == "__enum_"

to this:

IF Left(THISFORM.odragnode.Text,9) == "Constants" or ;
Left(THISFORM.odragnode.Text,5) == "Enums" or ;
Left(THISFORM.odragnode.Key,7) == "__enum_"

In the CreateConstantsCode method add this fragment to put the enum group
name into the all constants

if ( lnMode = 0 )
lcText = lcText + chr(13) + chr(10) + "* " + loEnum.Name + chr(13) +
chr(10)
endif

FOR lnCounter = 1 TO loEnum.Members.Count

this will add a comment providing the name of the enum group into the
output.


--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro

"Tim Witort" <trw7at@ixdot.netcomdotcom> wrote in message
news:Xns96BBAD9626E27timwitortwrotethis@207.217.125.201...
>
>> Tim Witort wrote:
>>> I am writing a VFP8 application and am automating a
>>> third-party application that offers a COM interface. Unfortunately,
>>> the company that wrote this third-party application does not
>>> have a list of the enumerations used in their system. As a
>>> result, I can only determine enumeration values by using the
>>> VB object browser. This is very tediuous.
>>>
>>> Is there a tool around that can extract and print all of the
>>> enumerations in a COM server? I know this could probably be
>>> programmed using TLBINF32.DLL, but I was hoping a freeware tool
>>> already existed that can just be given the name of the COM server
>>> to dump all of the enumerations and their values.
>>>
>>> Does such a tool exist?



Re: Utility to extract/print all enumerations? by trw7at

trw7at
Wed Aug 24 12:26:15 CDT 2005

David Frankenbach seemed to utter in
news:#DEHIPEqFHA.3720@TK2MSFTNGP14.phx.gbl:

> Tim,
>
> I posted this as some ER code a while back.. until it makes it into VFP
> there is a way to fix this shortcoming. pull the object browser code
> out of the xsource.zip file and make these minor mods:
>
> We can drag the Constants item and get a dump of all the #defines. We
> can NOT drag/drop the Enums item and get all of the enums dumped at one
> time.
>
> In trvHierarchy.OLESetData change this if:
>
> IF Left(THISFORM.odragnode.Text,9) == "Constants" OR
> Left(THISFORM.odragnode.Key,7) == "__enum_"
>
> to this:
>
> IF Left(THISFORM.odragnode.Text,9) == "Constants" or ;
> Left(THISFORM.odragnode.Text,5) == "Enums" or ;
> Left(THISFORM.odragnode.Key,7) == "__enum_"
>
> In the CreateConstantsCode method add this fragment to put the enum
> group name into the all constants
>
> if ( lnMode = 0 )
> lcText = lcText + chr(13) + chr(10) + "* " + loEnum.Name +
> chr(13) +
> chr(10)
> endif
>
> FOR lnCounter = 1 TO loEnum.Members.Count
>
> this will add a comment providing the name of the enum group into the
> output.
>
>

That is an awesome fix! Works like a charm!

I did find one bug in the object browser application though.
In the CreateConstantsCode method, an array of constants is
maintained to make sure duplicate constants are not placed
in the file. If EXACT is set to OFF (which it is by default),
any enumeration whose name matches the first letters of a
prior entry will be skipped. For example, if a prior enumeration
named "cXray" were placed in the file, a subsequent enumeration
named "cX" would not be placed in the file.

To fix, simply surround this checking code with a SET EXACT ON
and conditionally turning it back off:

** We check whether we already added that constant...

llExactOff = "OFF" $ SET("EXACT")
SET EXACT ON
llAdded = .F.
IF NOT lnCounter3 = 0
lnCounter4 = ASCAN(laConstants,lcName)
IF lnCounter4 > 0
llAdded = .T.
ENDIF
ENDIF
IF llExactOff
SET EXACT OFF
ENDIF

Also, I noticed that dragging the "Constants" node into a code
window resulted in exactly the same listing of the enumerations
as dragging the "Enums" node. I wonder if this is the reason
why dragging the Enums node is not supported by default? What
else might be in the Constants node besides the enumerations?

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

SV: Utility to extract/print all enumerations? by Anders

Anders
Wed Aug 24 14:33:56 CDT 2005

Hi Tim
ASCAN accepts a 6th paramter nFlags
nFlags = 7 case insensitive, exact on

-Anders


Den 05-08-24 19.26, i artikeln
Xns96BC6A38DE99Ftimwitortwrotethis@207.217.125.201, skrev "Tim Witort"
<trw7at@ixdot.netcomdotcom>:

> David Frankenbach seemed to utter in
> news:#DEHIPEqFHA.3720@TK2MSFTNGP14.phx.gbl:
>
>> Tim,
>>
>> I posted this as some ER code a while back.. until it makes it into VFP
>> there is a way to fix this shortcoming. pull the object browser code
>> out of the xsource.zip file and make these minor mods:
>>
>> We can drag the Constants item and get a dump of all the #defines. We
>> can NOT drag/drop the Enums item and get all of the enums dumped at one
>> time.
>>
>> In trvHierarchy.OLESetData change this if:
>>
>> IF Left(THISFORM.odragnode.Text,9) == "Constants" OR
>> Left(THISFORM.odragnode.Key,7) == "__enum_"
>>
>> to this:
>>
>> IF Left(THISFORM.odragnode.Text,9) == "Constants" or ;
>> Left(THISFORM.odragnode.Text,5) == "Enums" or ;
>> Left(THISFORM.odragnode.Key,7) == "__enum_"
>>
>> In the CreateConstantsCode method add this fragment to put the enum
>> group name into the all constants
>>
>> if ( lnMode = 0 )
>> lcText = lcText + chr(13) + chr(10) + "* " + loEnum.Name +
>> chr(13) +
>> chr(10)
>> endif
>>
>> FOR lnCounter = 1 TO loEnum.Members.Count
>>
>> this will add a comment providing the name of the enum group into the
>> output.
>>
>>
>
> That is an awesome fix! Works like a charm!
>
> I did find one bug in the object browser application though.
> In the CreateConstantsCode method, an array of constants is
> maintained to make sure duplicate constants are not placed
> in the file. If EXACT is set to OFF (which it is by default),
> any enumeration whose name matches the first letters of a
> prior entry will be skipped. For example, if a prior enumeration
> named "cXray" were placed in the file, a subsequent enumeration
> named "cX" would not be placed in the file.
>
> To fix, simply surround this checking code with a SET EXACT ON
> and conditionally turning it back off:
>
> ** We check whether we already added that constant...
>
> llExactOff = "OFF" $ SET("EXACT")
> SET EXACT ON
> llAdded = .F.
> IF NOT lnCounter3 = 0
> lnCounter4 = ASCAN(laConstants,lcName)
> IF lnCounter4 > 0
> llAdded = .T.
> ENDIF
> ENDIF
> IF llExactOff
> SET EXACT OFF
> ENDIF
>
> Also, I noticed that dragging the "Constants" node into a code
> window resulted in exactly the same listing of the enumerations
> as dragging the "Enums" node. I wonder if this is the reason
> why dragging the Enums node is not supported by default? What
> else might be in the Constants node besides the enumerations?
>
> -- TRW
> _______________________________________
> t r w 7
> at
> i x dot n e t c o m dot c o m
> _______________________________________


Re: SV: Utility to extract/print all enumerations? by trw7at

trw7at
Wed Aug 24 17:36:53 CDT 2005

> Den 05-08-24 19.26, i artikeln
> Xns96BC6A38DE99Ftimwitortwrotethis@207.217.125.201, skrev "Tim Witort"
> <trw7at@ixdot.netcomdotcom>:
>
>> David Frankenbach seemed to utter in
>> news:#DEHIPEqFHA.3720@TK2MSFTNGP14.phx.gbl:
>>
>>> Tim,
>>>
>>> I posted this as some ER code a while back.. until it makes it into VFP
>>> there is a way to fix this shortcoming. pull the object browser code
>>> out of the xsource.zip file and make these minor mods:
>>>
>>> We can drag the Constants item and get a dump of all the #defines. We
>>> can NOT drag/drop the Enums item and get all of the enums dumped at one
>>> time.
>>>
>>> In trvHierarchy.OLESetData change this if:
>>>
>>> IF Left(THISFORM.odragnode.Text,9) == "Constants" OR
>>> Left(THISFORM.odragnode.Key,7) == "__enum_"
>>>
>>> to this:
>>>
>>> IF Left(THISFORM.odragnode.Text,9) == "Constants" or ;
>>> Left(THISFORM.odragnode.Text,5) == "Enums" or ;
>>> Left(THISFORM.odragnode.Key,7) == "__enum_"
>>>
>>> In the CreateConstantsCode method add this fragment to put the enum
>>> group name into the all constants
>>>
>>> if ( lnMode = 0 )
>>> lcText = lcText + chr(13) + chr(10) + "* " + loEnum.Name +
>>> chr(13) +
>>> chr(10)
>>> endif
>>>
>>> FOR lnCounter = 1 TO loEnum.Members.Count
>>>
>>> this will add a comment providing the name of the enum group into the
>>> output.
>>>
>>>
>>
>> That is an awesome fix! Works like a charm!
>>
>> I did find one bug in the object browser application though.
>> In the CreateConstantsCode method, an array of constants is
>> maintained to make sure duplicate constants are not placed
>> in the file. If EXACT is set to OFF (which it is by default),
>> any enumeration whose name matches the first letters of a
>> prior entry will be skipped. For example, if a prior enumeration
>> named "cXray" were placed in the file, a subsequent enumeration
>> named "cX" would not be placed in the file.
>>
>> To fix, simply surround this checking code with a SET EXACT ON
>> and conditionally turning it back off:
>>
>> ** We check whether we already added that constant...
>>
>> llExactOff = "OFF" $ SET("EXACT")
>> SET EXACT ON
>> llAdded = .F.
>> IF NOT lnCounter3 = 0
>> lnCounter4 = ASCAN(laConstants,lcName)
>> IF lnCounter4 > 0
>> llAdded = .T.
>> ENDIF
>> ENDIF
>> IF llExactOff
>> SET EXACT OFF
>> ENDIF
>>
>> Also, I noticed that dragging the "Constants" node into a code
>> window resulted in exactly the same listing of the enumerations
>> as dragging the "Enums" node. I wonder if this is the reason
>> why dragging the Enums node is not supported by default? What
>> else might be in the Constants node besides the enumerations?
>>
>> -- TRW
>> _______________________________________
>> t r w 7
>> at
>> i x dot n e t c o m dot c o m
>> _______________________________________

Anders seemed to utter in news:BF329844.2739%anders.altberg@telia.com:

> Hi Tim
> ASCAN accepts a 6th paramter nFlags
> nFlags = 7 case insensitive, exact on
>
> -Anders

Right, but you must supply the other intervening 3 arguments
in order to use it. It was easier to turn on EXACT than
to include the other unwanted arguments. It is also clearer
that my code is doing an exact text search than to include
the cryptic binary flag argument in ASCAN(). Personal
preferences, I suppose.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

Re: Utility to extract/print all enumerations? by David

David
Wed Aug 24 21:23:14 CDT 2005

Tim,

> That is an awesome fix! Works like a charm!

Thanks.

> I did find one bug in the object browser application though.
> In the CreateConstantsCode method,
>
> To fix, simply surround this checking code with a SET EXACT ON
> and conditionally turning it back off:

Good catch I'll have to make the same tweak. Thanks.

> Also, I noticed that dragging the "Constants" node into a code
> window resulted in exactly the same listing of the enumerations
> as dragging the "Enums" node. I wonder if this is the reason
> why dragging the Enums node is not supported by default? What
> else might be in the Constants node besides the enumerations?

Well dragging the Constants node results in all the constants being dumped
in alpha order with no regard to the Enum groupings. I find the Enum groups
to just as relevant information as knowing what the constant values are.


--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro



Re: Utility to extract/print all enumerations? by Sergey

Sergey
Wed Aug 24 22:07:08 CDT 2005


In VFP8 and later fix can be simpler

lnCounter4 = ASCAN(laConstants,lcName, -1,-1,-1, 2+4)

--sb--

>
> That is an awesome fix! Works like a charm!
>
> I did find one bug in the object browser application though.
> In the CreateConstantsCode method, an array of constants is
> maintained to make sure duplicate constants are not placed
> in the file. If EXACT is set to OFF (which it is by default),
> any enumeration whose name matches the first letters of a
> prior entry will be skipped. For example, if a prior enumeration
> named "cXray" were placed in the file, a subsequent enumeration
> named "cX" would not be placed in the file.
>
> To fix, simply surround this checking code with a SET EXACT ON
> and conditionally turning it back off:
>
> ** We check whether we already added that constant...
>
> llExactOff = "OFF" $ SET("EXACT")
> SET EXACT ON
> llAdded = .F.
> IF NOT lnCounter3 = 0
> lnCounter4 = ASCAN(laConstants,lcName)
> IF lnCounter4 > 0
> llAdded = .T.
> ENDIF
> ENDIF
> IF llExactOff
> SET EXACT OFF
> ENDIF
>
> Also, I noticed that dragging the "Constants" node into a code
> window resulted in exactly the same listing of the enumerations
> as dragging the "Enums" node. I wonder if this is the reason
> why dragging the Enums node is not supported by default? What
> else might be in the Constants node besides the enumerations?
>

Re: Utility to extract/print all enumerations? by trw7at

trw7at
Thu Aug 25 10:22:12 CDT 2005

David Frankenbach seemed to utter in
news:OcI10vRqFHA.1156@TK2MSFTNGP12.phx.gbl:

>> Also, I noticed that dragging the "Constants" node into a code
>> window resulted in exactly the same listing of the enumerations
>> as dragging the "Enums" node. I wonder if this is the reason
>> why dragging the Enums node is not supported by default? What
>> else might be in the Constants node besides the enumerations?
>
> Well dragging the Constants node results in all the constants being
> dumped in alpha order with no regard to the Enum groupings. I find the
> Enum groups to just as relevant information as knowing what the
> constant values are.

In my tests, the results were identical - they both grouped
the constant values under the headings of the enumeration name
in exactly the same way. The resulting files were literaly
identical. Perhaps the result would be different with some
other library?

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________