ChrisS has asked for the wisdom of the Perl Monks concerning the following question:

I would like to use a OLE/COM control in a Perl app.

Unfortunately, all the docs I can find show how to launch an Application (like Outlook or Excel) but don't suggest a way to use a control outside of one of those applications.

I suppose I could try creating a blank user form in Excel and attaching the desired control to the form, then use the Win32::OLE module to launch Excel and run the form; but, I don't like the idea of launching Excel just to get to a control, when I don't need Excel to do anything else.

Any ideas?

(Yes, I know that this concept guarantees non-portable code, and I have to handle what happens if the componenet isn't installed on someone else's machine - or a different version is installed, etc.)

Replies are listed 'Best First'.
Re: OLE/COM Controls
by Jenda (Abbot) on Jul 18, 2003 at 22:08 UTC

    Could you give us more info? What control? What do you want to do with it?

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature

      yes, some more information would be useful, i have just finished a piece of code that uses win32::ole to execute another program in order to communicate with the parallel port. What program do you want to execute? Do you want to pass variables ?

        I see I haven't been clear enough, or provided enough information. I don't want to execute a program. I want to create a Perl script that can act as a container for a control.

        The exact control probably won't help you, since you might not have it installed.

        The control I would like to use does have a GUI interface, and a Value property that I would like to return to the Perl script.

        In short, I would like to have my Perl script create an instance of the control, allow the user to interact with its GUI, and fetch a property (named "Value").

        I hope that helps. Thanks!