From: Shusaku Date: 2002-12-02T22:28:57+09:00 Subject: Re: WIN32OLE On Sun, 01 Dec 2002 23:50:25 GMT Shannon Fang wrote: > Thanks for the info. However, what I want is not to find out the com dll, > but what did the win32ole obj used. for example, > > conn=WIN32OLE.new("ADODB.Connection") > xl=WIN32OLE.new("Excel.Application") > > conn.class==xl.class >> True > > In RUBY program, how can I know if a win32ole object is an instance of > adodb or excel? You can get GUID(UUID) from WIN32OLE_TYPE object. require 'win32ole' conn = WIN32OLE.new("ADODB.Connection") #=> # conn_type = conn.ole_obj_help #=> # conn_type.guid #=> "{00000550-0000-0010-8000-00AA006D2EA4}" conn_type.helpstring #=> "" conn_type.helpfile #=> "C:\\WINNT\\HELP\\ado210.chm" conn_type.helpcontext #=> 1231105 xl=WIN32OLE.new("Excel.Application") xl_type = xl.ole_obj_help xl_type.guid #=> "{000208D5-0000-0000-C000-000000000046}" xl_type.helpstring #=> "" xl_type.helpfile #=> "C:\\MyProg\\MSOffice\\Office\\VBAXL9.CHM" xl_type.helpcontext #=> 131073 conn2 = WIN32OLE.new("ADODB.Connection") #=> # conn_type.guid == xl_type.guid #=> false conn_type.guid == conn2.ole_obj_help.guid #=> true Some inferface has a 'helpstring', which is more readable than guid. :-) ie = WIN32OLE.new('InternetExplorer.Application') ie_type = ie.ole_obj_help ie_type.guid #=> "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}" ie_type.helpstring #=> "Web Browser Interface for IE4." ie_type.helpfile #=> "" ie_type.helpcontext #=> 0 -- Shusaku