A windows ole question - howto start an external application

Dear "damphyr",

thank you very much - that's just what I needed (for now).
One interesting question remains however for the Unix-lover and only
occasional
Windows developer :
I guess from your response that if a Windows application does have an API,
it will be easily accessible from Ruby.
Is there some tutorial how to do this (<10000 pages) ?

Thank you,

Axel

Nuralanur@aol.com wrote:

Dear "damphyr",
thank you very much - that's just what I needed (for now).
One interesting question remains however for the Unix-lover and only occasional
Windows developer :
I guess from your response that if a Windows application does have an API,
it will be easily accessible from Ruby.
Is there some tutorial how to do this (<10000 pages) ?

Well, it'S actually very simple - the complex part starts from when you have a reference to an OLE Object and no reference of the API :).

A typical OLE connection would go

app=WIN32OLE.new(APP_NAME)
obj=app.get_some_object_through_api_call
obj.call_a_method

You need to wrap this with some rescue clauses to catch the exceptions and you're OK.
As you see, there's nothing to do a tutorial about.
You do need a good reference of the API you want to use, but you'll find out that the win32ole Ruby stuff follow the general Ruby rule:
they do what you expect.
You don't need more than the standard library documentation for the ruby side:
http://www.ruby-doc.org/stdlib/libdoc/win32ole/rdoc/classes/WIN32OLE.html
I must say I prefer coding windows stuff using the ruby OLE interface (even if it's a hundred times slower) than dive again in the insane world of .tlbs and IUnknown interfaces.
Cheers,
V.-

···

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.