Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Win32OLE and remote servers?

8 views
Skip to first unread message

rubyh...@gmail.com

unread,
Jul 7, 2005, 5:11:33 PM7/7/05
to
I'm rying to figure out whether it's possible to
talk to the COM interface of a program running
on a remote machine.

I thought this was impossible, but someone suggested
it might be possible.

Thanks for any info...


Cheers,
Hal

Corey Lawson

unread,
Jul 7, 2005, 5:39:08 PM7/7/05
to
You might be able to via the WMI interfaces. Look up some VBScript +
WMI code via Google (or on MSDN), and that would be a good start.

By default, most/all of the WMI methods work on a local instance,
unless given a \\remotecomputer name.

Of course, this is also assuming you have the right privileges (i.e.,
domain administrator).

-Corey

Shashank Date

unread,
Jul 7, 2005, 5:41:21 PM7/7/05
to
Hi Hal,

--- rubyh...@gmail.com wrote:

> I'm rying to figure out whether it's possible to
> talk to the COM interface of a program running
> on a remote machine.
>
> I thought this was impossible, but someone suggested
> it might be possible.

I believe it is possible by virtue of DCOM (Distributed COM). I have never used it before but here
is a good starting point:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndcom/html/msdn_dcomhb.asp

> Thanks for any info...
>
>
> Cheers,
> Hal

-- shanko

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


rubyh...@gmail.com

unread,
Jul 7, 2005, 6:29:36 PM7/7/05
to
Thanks, Corey and Shashank...

It sounds like my first impulse might well be the easiest one --
to wrap a COM server with Ruby and then share it remotely
using drb.

To talk to a local COM-aware app, there's no reason Win32OLE
shouldn;t suffice, is there? Ralph Mason had a thing called
RubyCOM -- I used to know the difference, but I've forgotten.


Cheers,
Hal

daz

unread,
Jul 7, 2005, 7:52:45 PM7/7/05
to

Shashank Date

unread,
Jul 7, 2005, 9:23:52 PM7/7/05
to
Hal,

> It sounds like my first impulse might well be the easiest one --
> to wrap a COM server with Ruby and then share it remotely
> using drb.

Correct ... that would be my impulse too :-)



> To talk to a local COM-aware app, there's no reason Win32OLE
> shouldn;t suffice, is there?

Depends on the app ... rather the documentation (or the lack thereof) that comes with it.
But yes, in general there is no reason that Win32OLE shouldn't suffice.

Which COM aware app(s) are we talking of here?
-- shanko



____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.
http://auctions.yahoo.com/


Shashank Date

unread,
Jul 8, 2005, 12:08:15 PM7/8/05
to
Hi Daz,

Sorry, I missed your post.

I have tried the trick mentioned in that post but could not get it to work.
Here is the segment I tried:

#####################
require 'win32ole'

excel = WIN32OLE.new("excel.application",'localhost') # 'wsdev01')
excel['Visible'] = true
spreadsheet = excel.Workbooks.Open("C:\\junk.xls")
sheet = spreadsheet.Worksheets(1).Range("D1")
excel.Columns("A:A").select
excel.Sheets(1).Range("D1")

excel.Selection.Font.Name = "Arial"
excel.Selection.Font.FontStyle = "Normal"
excel.Selection.Font.Size = 14

excel.DisplayAlerts = false
excel.ActiveWorkbook.Save
excel.Workbooks.Close
excel.DisplayAlerts = true
#############################################

When I ran it with 'localhost' it ran fine. But when I changed it to
'wsdev01' which is a machine on the network which my machine can see
and has Excel installed on it, the script error'd out saying:

C:/atest/tst_excel.rb:6:in `initialize': Failed to create DCOM server `excel.application' in
`wsdev01' (WIN32OLERuntimeError)
HRESULT error code:0x80070005
Access is denied. from C:/atest/tst_excel.rb:6:in `new'
from C:/atest/tst_excel.rb:6

Any hints as to what I could be doing wrong?
Thanks,

Shashank Date

unread,
Jul 8, 2005, 1:34:28 PM7/8/05
to

Hi,

--- Shashank Date <shank...@yahoo.com> wrote:

>
> I have tried the trick mentioned in that post but could not get it to work.
>

Ok, I take that back. I found this KB article on

http://support.microsoft.com/kb/q158582/

and when I set up the client and the server properly using DCOMCNFG.exe, I was able to run the
script (without the Save).

0 new messages