wa4otj has asked for the wisdom of the Perl Monks concerning the following question:
I am a relative newbie to Perl, but have been learning for a few months. I have written a fair amount of Perl code thus far, and have now attacked the most ambitious project yet. I am on the verge of admitting defeat and going over to the dark side and using VB.
I have installed the OLE PPM and tested many examples for controlling Word and Excel without problems. I thought I had this OLE stuff groked and could write automation code.
I have this non-Microsoft application with a brand new, beta OCX interface, with VB examples of controlling it. I have translated many calls from the VB examples to Perl, to no avail.
I have posted many detail questions here, and received valuable answers. I can now create my obj server, query object type and get the proper response, and destroy the object. But no calls to any function or method succeeds. I have spent many hours on the web studying tutorials and sample code for Microsoft and lotus applications.
I am starting to suspect that there is some significant deficit wrt support for OCX's vs. VB that I am somehow missing. This morning while surfing the web yet again for samples and documentation I came across a statement to the effect that Perl OLE does not support OCX. This threw me into panic.
The statement was without further elaboration, but caused me to think that the reason all my calls are failing is not that I am doing something wrong, but rather that there is something about the objects and methods I am calling that makes them different from similar appearing calls to, for example, Excel.
Perhaps there is some aspect of this that Win32::OLE isn't supporting, or perhaps there is something fundamentally broken in the application itself that locks it in to being called from VB.
I need enlightenment from the Monks, show me the error of my ways. I have used OLEView and the perl Browser-OLE to examine the objects. I have looked at them in the machines registry. I am at a loss as to why my calls fail.
For example: The file is HALi.OCX. The library is HALiCnt. There is a class CModes, which contains a property Count as a readonly Long. There is a Class HALi which contains a property Modes as _CModes. My server is HALiCnt.HALi. By everything I have read, the statement:
$HALi = Win32::OLE->new('HALiCnt.HALi')
my $c = $HALi->Modes->Count();
should return the number of Modes defined, which is in actuality known by me to be 5. Instead I get "Can't call method Count on undefined value".
I have experimented for hours with many variations of the call, and with many other calls of a similar nature in the library. Nothing! Nada!
Am I overlooking something fundamental in Perl's support of OLE automation?? Must I tuck my tail and move with the masses to VB to access this application?
Please enlighten me.
Nathan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl for OLE & OCX
by Ninthwave (Chaplain) on Jun 16, 2004 at 16:58 UTC | |
by meetraz (Hermit) on Jun 16, 2004 at 17:01 UTC | |
by Ninthwave (Chaplain) on Jun 16, 2004 at 17:10 UTC | |
by wa4otj (Beadle) on Jun 16, 2004 at 17:17 UTC | |
by Solo (Deacon) on Jun 16, 2004 at 17:25 UTC | |
| |
by wa4otj (Beadle) on Jun 16, 2004 at 17:11 UTC | |
by wa4otj (Beadle) on Jun 16, 2004 at 17:09 UTC | |
by Ninthwave (Chaplain) on Jun 16, 2004 at 17:22 UTC | |
|
Re: Perl for OLE & OCX
by meetraz (Hermit) on Jun 16, 2004 at 16:59 UTC | |
by wa4otj (Beadle) on Jun 16, 2004 at 17:05 UTC | |
|
Re: Perl for OLE & OCX
by NetWallah (Canon) on Jun 16, 2004 at 17:24 UTC | |
by wa4otj (Beadle) on Jun 16, 2004 at 19:05 UTC | |
by NetWallah (Canon) on Jun 16, 2004 at 19:26 UTC | |
by wa4otj (Beadle) on Jun 16, 2004 at 21:23 UTC |