WIN32OLE type binding

B

Bruno Le hyaric

Hi,

My COM Web Browser is making progress...
I can scan COM API, get and set properties value.

The next step is to permit RPC on methods.

Ruby reflexivity let me know :
- the list of methods for an object,
- parameters and their types for each method.

Now I seek for introspection about type binding between Ruby and COM...
I looked at the documentation where I see we can get all COM
classes...but not what I want. Here is an example of what I'm looking
for :

BSTR => String
I4 => Fixnum
F8 => Float
...


does anybody got an advice?
 
G

Gregory Brown

Hi,

My COM Web Browser is making progress...
I can scan COM API, get and set properties value.

The next step is to permit RPC on methods.

Can you clarify your question a little bit? I'm not sure whether
you're asking how to call methods on an WIN32OLE object that are
provided by a DLL, or if you're looking for introspection that will
provide a methods signature...

-greg
 
B

Bruno Le hyaric

Gregory said:
Can you clarify your question a little bit? I'm not sure whether
you're asking how to call methods on an WIN32OLE object that are
provided by a DLL, or if you're looking for introspection that will
provide a methods signature...

-greg

Ok, I have a graphic interface from wich I want to call COM methods.
By introspection I know the signature of methods.
The problem is that my interface (a web page) only permits text input.
So all values I enter are Strings. I need to cast or interpret strings
to match parameters types...

I solve the problem for put properties like that :

# obj : COM object
# prop : name of the property
# value : string value I want to put
def cast_from_string(obj,prop,value)

#call the get property, only to know the type of the Ruby object
type = obj.send prop.to_sym

#match on Ruby types and convert the string accordingly...
case type
when Integer
return value.to_i
when Float
return value.to_f
when TrueClass, FalseClass
return value == true.to_s
else
return value
end
end



So I want to convert String to the matching Ruby type
To do that, I need to have a list of COM types and their matched Ruby
types.
I wonder if there is that information somewhere in WIN32OLE...

I take a screenshot of the web page so you can have an better idea on
what I'm trying to do :)


Attachments:
http://www.ruby-forum.com/attachment/3813/screen.JPG
 
G

Gregory Brown

So I want to convert String to the matching Ruby type
To do that, I need to have a list of COM types and their matched Ruby
types.
I wonder if there is that information somewhere in WIN32OLE...

I take a screenshot of the web page so you can have an better idea on
what I'm trying to do :)

Oh I see, when you said COM Web Browser I thought you meant something
like building your own browser calling out to IE.
You literally meant browsing COM objects on the web. Interesting
idea... do you plan to open source this?

Unfortunately, I'm a bit of a WIN32OLE newb and this takes me a bit
out of my element. So maybe someone else can help you here.
 
M

Masaki Suketa

Hello,
So I want to convert String to the matching Ruby type
To do that, I need to have a list of COM types and their matched Ruby
types.
I wonder if there is that information somewhere in WIN32OLE...

Sorry, but there is no way to get that information from Win32OLE.
The only way is reading win32ole.c(ole_variant2val() and
ole_val2variant()).

Regards,
Masaki Suketa
 

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,143
Latest member
DewittMill
Top