Using COM objects in IDL (Win32 only) [message #31184] |
Thu, 20 June 2002 12:59 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
While enjoying some "free time" today I started looking at IDL COM objects
(introduced in 5.5?). The only documentation I could find is in "What's new
in 5.5". It is helpful, but far from complete.
I am able to browse the available objects using the OLE/COM Object browser
and I can get the details on the methods and props using the ItypeInfo
Viewer. But, when I try to invoke methods or get/set properties I have
mixed luck.
For example:
I can create a browser object ({8856F961-340A-11D0-A96B-00C04FD705A2}) and
use the navigate method to point it to an url:
aXwidget=WIDGET_ACTIVEX(tlb, $
'{8856F961-340A-11D0-A96B-00C04FD705A2}')
WIDGET_CONTROL, tlb, /REALIZE
WIDGET_CONTROL, aXwidget, GET_VALUE = aXobject
aXobject -> navigate, 'http:\\www.acoustics.washington.edu'
But, when I create a progress bar COM
object({35053A22-8589-11D1-B16A-00C0F0283628}), I run into all sorts of
problems setting properties:
aXwidget=WIDGET_ACTIVEX(tlb, $
'{35053A22-8589-11D1-B16A-00C0F0283628}')
WIDGET_CONTROL, tlb, /REALIZE
WIDGET_CONTROL, aXwidget, GET_VALUE = aXobject
aXobject-> getproperty, min=mn, max=mx, value=v
print,mn,mx,v
aXobject-> setproperty, min=20., value=30.
aXobject-> getproperty, min=mn, max=mx, value=v
print,mn,mx,v
the above code results in the following output:
IDL> activex_test
0.000000 100.000 0.000000
0.000000 100.000 0.000000
As you can see, my call to setproperty had no effect. To confound things
further, adding "max" to setproperty results in an error.
Does anyone know how reliably access the methods and properties of COM
objects? I thought that I understood the info from the OLE/COM object
browser and ITypeInfo viewer but obviously I am missing something.
-Rick
|
|
|