ActiveX Enumerations

J

JoeH

Hi,

I'm using a COM DLL (created in VB) in my javascript code and can
successfully call its methods and get/set its properties. There are
also some Public enumerations defined in the ActiveX DLL I'd like to
access -- is this possible?

Thanks,

Joe
 
A

Alexis Nikichine

JoeH said:
Hi,

I'm using a COM DLL (created in VB) in my javascript code and can
successfully call its methods and get/set its properties. There are
also some Public enumerations defined in the ActiveX DLL I'd like to
access -- is this possible?

Not being an expert, my best bet would be to use an Enumerator (JScript
specific).

The following short example may get you started:

var wmi = new
Enumerator(GetObject("winmgmts:").InstancesOf("Win32_process"));

for( ; !wmi.atEnd(); wmi.moveNext() )
{
var process = wmi.item();
alert( "process.name" );
}


I've told that this Enumerator stuff helps iterating (using atEnd,
moveNext and Item) through COM enumerations.

Hope this helps,

Alexis
 
A

Alexis Nikichine

JoeH said:
I'm using a COM DLL (created in VB) in my javascript code and can
successfully call its methods and get/set its properties. There are
also some Public enumerations defined in the ActiveX DLL I'd like to
access -- is this possible?

My best bet would be to use an Enumerator (JScript specific).

The following short example may get you started:

var wmi = new
Enumerator(GetObject("winmgmts:").InstancesOf("Win32_process"));

for( ; !wmi.atEnd(); wmi.moveNext() )
{
var process = wmi.item();
alert( "process.name" );
}


I'm being told that this Enumerator stuff helps iterating (using atEnd,
moveNext and item methods) through COM enumerations.

Cheers,

Alexis
 
J

JoeH

Thanks Alexis,

I was hoping I'd be able to reference the enumeration items (from the
DLL) by name vs. looping through them -- but this was an informative
code snippet nonetheless.

Regards,

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top