Ruby and COM

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-forum.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.

···

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.

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-forum.com/\.

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

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-forum.com/\.

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

Hi!

COM consists of a dll

DLL... or Exe, or Exe + other extensions, or etc.

COM consists ... and tlb file

TLB is only for statics COM-servers ; dynamic COM-servers no have TLB, but run OK (by exemple, COM-servers made with Python)

···

--
@-salutations

Michel Claveau

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

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

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-forum.com/.

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:

···

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)

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:
Larry Osterman's WebLog | Microsoft Learn

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-forum.com/\.

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.

···

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:
> Larry Osterman's WebLog | Microsoft Learn

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.

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-forum.com/\.

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.)

···

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?