http://qs321.pair.com?node_id=648315

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

It seems that there used to be a module Win32::DDE::Client, but that module is no longer on CPAN or anywhere because DDE has since been replaced by OLE. However, while the Win32::DDE::Client interface was easy to understand:
Request(ITEM) Returns the value of ITEM from the DDE server. Poke (ITEM, VALUE) Pokes VALUE into ITEM at the DDE server. Execute (CMD) Executes CMD at the DDE server.
I'm having a lot of trouble understanding the Win32::OLE equivalents:
http://search.cpan.org/~jdb/libwin32-0.28/OLE/lib/Win32/OLE.pm

Can someone explain how I do the equivalent of Request, Poke, and Execute using OLE?

Replies are listed 'Best First'.
Re: DDE calls using Win32::OLE?
by Jenda (Abbot) on Oct 31, 2007 at 20:03 UTC

    The fact that OLE superceeded DDE doesn't mean that you can control an application that provides a DDE interface using Win32::OLE. If the app only allows you to control it via DDE, you have to use DDE. You should be able to install Win32::DDE from http://www.bribes.org/perl/ppm/.

    c:\> ppm ppm> rep add bribes http://www.bribes.org/perl/ppm/ ppm> search Win32::DDE ppm> install 1
      I already have Win32::DDE, but the documentation says it's a low-level interface and not really meant to be used on its own. If I have to use DDE and not OLE, then that means I really need Win32::DDE::Client as well - but nobody on the Internet seems to offer it. Short of that, I need to know how to use the standard DDE calls with the base Win32::DDE.

      jdporter: I'm trying to connect to ZIP4. This is a sample from the documentation:

      DDECONNECT<service=ZP4, topic=Addresses> [client links to ZP4.EXE] POKE<InputOrder, Address & City> [client promises to send records wit +h address and city fields] POKE<OutputOrder, State (final) & ZIP (final)> [client wants to get b +ack the state and ZIP+4 code] REQUEST<Data & 207 grenada & rio del mar> [client sends an address to + ZP4.EXE] RESPONSE = CA & 95003-5007 [ZP4.EXE responds with state and ZIP+4 cod +e] REQUEST<Data & 401 granite & seacliff> [client sends an address to ZP +4.EXE] RESPONSE = CA & 95003-3908 [ZP4.EXE responds with state and ZIP+4 cod +e] REQUEST<Data & 207 granada & aptos> [client sends an address to ZP4.E +XE] RESPONSE = CA & 95003-5007 [ZP4.EXE responds with state and ZIP+4 cod +e] The complete list of DDE transactions recognized by ZP4.EXE is: Poke "InputOrder" <fields> Poke "OutputOrder" <fields> Poke "TimeLimit" <milliseconds> Poke "StopCASS" <filename> Execute "Refresh" Execute "Freeze" Execute "StartCASS" Request "Data" Request "ErrorMessages" Request "AllOutputs" Request "Plus4Lookup"
        I really need Win32::DDE::Client as well - but nobody on the Internet seems to offer it.

        You can get it from bribes. Just install Win32::DDE; it's part of that.

        A word spoken in Mind will reach its own level, in the objective world, by its own weight
      My bad. Apparently Win32::DDE::Client installs with the Win32::DDE package. I didn't think of checking that, since I'm used to having to choose the specific modules I want when using ppm. I should be good to go now.
Re: DDE calls using Win32::OLE?
by jdporter (Paladin) on Oct 31, 2007 at 19:34 UTC

    OLE is just a remote object interface. How you use it — you can do with it — is almost entirely determined by the remote objects you're accessing. If you would say what applications you're trying to automate, I could perhaps give you a leg up on talking to it with OLE.

    A word spoken in Mind will reach its own level, in the objective world, by its own weight