[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby and COM

Aureliano Buendia

11/13/2006 1:53:00 PM

Hi,

Is it possible to use a COM component library in Ruby? The COM consists
of a dll and a tlb file, it is NOT a .NET assembly, just a standard
windows COM.

--
Posted via http://www.ruby-....

11 Answers

Jano Svitok

11/13/2006 2:12:00 PM

0

On 11/13/06, Aureliano Buendia <saveez@hotmail.com> wrote:
> Hi,
>
> Is it possible to use a COM component library in Ruby? The COM consists
> of a dll and a tlb file, it is NOT a .NET assembly, just a standard
> windows COM.

It's possible if it is normally registered in the system, i.e. you are
able to use it from VB, wsh, etc. Have a look at WIN32OLE.

Patrick Spence

11/13/2006 2:21:00 PM

0


Aureliano Buendia wrote:
> Hi,
>
> Is it possible to use a COM component library in Ruby? The COM consists
> of a dll and a tlb file, it is NOT a .NET assembly, just a standard
> windows COM.
>
> --
> Posted via http://www.ruby-....
Yes. For example...

require 'win32ole'

begin

oCn = WIN32OLE.new("adodb.connection")
oCn.connectionString = "Provider=sqloledb;Data Source=(local);Initial
Catalog="northwind";Integrated Security=sspi;"

oCn.open()
puts("Connection opened to Northwind database")

rescue Exeception => ex
puts(ex.message())

ensure

oCn.close() unless oCn.nil?
oCn = nil

end


Patrick Spence

11/13/2006 2:22:00 PM

0


Aureliano Buendia wrote:
> Hi,
>
> Is it possible to use a COM component library in Ruby? The COM consists
> of a dll and a tlb file, it is NOT a .NET assembly, just a standard
> windows COM.
>
> --
> Posted via http://www.ruby-....
Yes. For example...

require 'win32ole'

begin

oCn = WIN32OLE.new("adodb.connection")
oCn.connectionString = "Provider=sqloledb;Data Source=(local);Initial
Catalog="northwind";Integrated Security=sspi;"

oCn.open()
puts("Connection opened to Northwind database")

rescue Exeception => ex
puts(ex.message())

ensure

oCn.close() unless oCn.nil?
oCn = nil

end


Patrick Spence

11/13/2006 2:26:00 PM

0

Oops... the name of the database should not be inside quotes!

oCn.connectionString = "Provider=sqloledb;Data Source=(local);Initial
Catalog=northwind;Integrated Security=sspi;"


Aureliano Buendia

11/13/2006 2:32:00 PM

0

Patrick,

Thanks. WIN32OLE.new needs the PROGID or CLSID, how is it possible to
find this out from a tlb file? (I know, this is not a Ruby question)

--
Posted via http://www.ruby-....

Wilson Bilkovich

11/13/2006 4:03:00 PM

0

On 11/13/06, Aureliano Buendia <saveez@hotmail.com> wrote:
> Patrick,
>
> Thanks. WIN32OLE.new needs the PROGID or CLSID, how is it possible to
> find this out from a tlb file? (I know, this is not a Ruby question)
>

If you don't have Visual Studio (which has a graphical COM browser),
or something similar, you can look in the registry.
This post tells you where to look:
http://blogs.msdn.com/larryosterman/archive/2006/01/10/5...

Aureliano Buendia

11/13/2006 5:27:00 PM

0

Wilson Bilkovich wrote:
> If you don't have Visual Studio (which has a graphical COM browser),
> or something similar, you can look in the registry.
> This post tells you where to look:
> http://blogs.msdn.com/larryosterman/archive/2006/01/10/5...

The only place that my tlb is registered is:

HKEY_LOCAL_MACHINE/SOFTWARE/Classes/TypeLib/{...}/version_number

where {...} is the CLSID and version_number is the version number. Using

WIN32OLE.new('{...}')

does not work as WIN32OLE cannot find this CLSID in the registy. Is this
a WIN32OLE problem? Maybe it only looks for some other places in the
registery.


--
Posted via http://www.ruby-....

Wilson Bilkovich

11/13/2006 5:33:00 PM

0

On 11/13/06, Aureliano Buendia <saveez@hotmail.com> wrote:
> Wilson Bilkovich wrote:
> > If you don't have Visual Studio (which has a graphical COM browser),
> > or something similar, you can look in the registry.
> > This post tells you where to look:
> > http://blogs.msdn.com/larryosterman/archive/2006/01/10/5...
>
> The only place that my tlb is registered is:
>
> HKEY_LOCAL_MACHINE/SOFTWARE/Classes/TypeLib/{...}/version_number
>
> where {...} is the CLSID and version_number is the version number. Using
>
> WIN32OLE.new('{...}')
>
> does not work as WIN32OLE cannot find this CLSID in the registy. Is this
> a WIN32OLE problem? Maybe it only looks for some other places in the
> registery.
>

Are you able to use this COM object from other
languages/applications/etc? I'm a little rusty, but it doesn't sound
properly registered to me.

Aureliano Buendia

11/13/2006 5:45:00 PM

0

Wilson Bilkovich wrote:
> On 11/13/06, Aureliano Buendia <saveez@hotmail.com> wrote:
>> where {...} is the CLSID and version_number is the version number. Using
>>
>> WIN32OLE.new('{...}')
>>
>> does not work as WIN32OLE cannot find this CLSID in the registy. Is this
>> a WIN32OLE problem? Maybe it only looks for some other places in the
>> registery.
>>
>
> Are you able to use this COM object from other
> languages/applications/etc? I'm a little rusty, but it doesn't sound
> properly registered to me.

The COM object can be used from visual basic 6, so it should be possible
to be accessed from anywhere else?

--
Posted via http://www.ruby-....

Wilson Bilkovich

11/13/2006 6:15:00 PM

0

On 11/13/06, Aureliano Buendia <saveez@hotmail.com> wrote:
> Wilson Bilkovich wrote:
> > On 11/13/06, Aureliano Buendia <saveez@hotmail.com> wrote:
> >> where {...} is the CLSID and version_number is the version number. Using
> >>
> >> WIN32OLE.new('{...}')
> >>
> >> does not work as WIN32OLE cannot find this CLSID in the registy. Is this
> >> a WIN32OLE problem? Maybe it only looks for some other places in the
> >> registery.
> >>
> >
> > Are you able to use this COM object from other
> > languages/applications/etc? I'm a little rusty, but it doesn't sound
> > properly registered to me.
>
> The COM object can be used from visual basic 6, so it should be possible
> to be accessed from anywhere else?
>

In Visual Studio 6, what does the COM browser say that the full name
is? (It has been a long time, but I think it is F4 or something like
that.)