I’m trying to interact with the Google Earth application through its COM
interface on a Windows machine. I’m able to start the application using
WIN32OLE.new ‘GoogleEarth.ApplicationGE’. I’m now trying to set the
camera using the OLE method setCameraParams. One of the parameters for
this method is an AltitudeModeGE enumeration defined in the COM
interface (see below).
OK, I’m in a similar fix with an OLE method that expects an enum…
I’m driving a proprietary COM object using WIN32OLE, and one of the
classes has a PROPERTYPUT method ‘type’ that expects enum of type
TRequestType, defined in the same typelib. In the documentation, this
method is described like this:
Property: type [in/out] enum TRequestType
When I run olegen script on this typelib, this is what comes out of it:
class DataStream
…
def type=(arg0) @dispatch._setproperty(4, [arg0], [VT_DISPATCH])
end
…
end
module TRequestType
include WIN32OLE::VARIANT
attr_reader :lastargs
OLE method stub seems to expect an OLE object, but I cannot instantiate
TRequestType enum… It has CLSID, but trying WIN32OLE.new with this
CLSID gives:
WIN32OLERuntimeError: failed to create WIN32OLE object from
`{508266CF-A83D-46FE-95B3-E8F892950E61}’
When I try to give this method Fixnum (say 1) instead of enum, I get:
TypeError: not valid value
WIN32OLE documentation does not mention how to work with OLE enums. I
tried to fiddle with WIN32OLE_VARIANT, but was unable to fugure out how
to use it properly… So, essentially I have no idea how to make this
enum and pass it into method that expects it.
Any help pushing me in the right direction is greatly appreciated… At
the very minimum, I need to understand in what direction to dig, and now
I’m at a total loss… Help?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.