[comp.windows.ms.programmer] comp.windows.ms

bengt@fires1 (Bengt A. Palsson) (05/02/91)

We are working on putting together a multimedia application under Windows 3.0 and
I have a few specific queries relating to running multiple applications under
Windows 3.0 communicating via DDE:

     1)   Is there a way to activate (start up) one application (that is NOT
          currently running), and then terminate it FROM another application
          that is currently running ? 

     For example:   I have applications X, Y and Z. X is currently running and
                    wants Y or Z to start running, perform a task and then
                    terminate. 

     The only possible solutions I could think of so far is: 

          a) To have all applications running at the time Windows is started up
          and then carry out all tasks via DDE and then close down all applica-
          tions when exiting Windows.

          b) Send a DDE message to the Program Manager telling it to start up
          a certain application, however, I don't know if the Program manager
          supports DDE in this manner.

     2)   Once we have successfully carried out the task at hand within the
          application (regardless of how it was started up), how do we switch
          back to the original (calling) application ?

     3)   When an application that currently is in the background recieves a DDE
          message to display something in a window, will its window automatical-
          ly move to "the front" or does that have to be a specific command via
          DDE ? 

If you have any input on this issue post it here or send me e-mail.

Thanks

--
Bengt A. Palsson                         | "It's not that I'm afraid of
FORD Scientific Research Labs            |  dying, I just don't want to be
Internet   : bpalsson@smail.srl.ford.com |  there when it happens."
Compuserve : 70541,3431                  |  - Woody Allen

Norbert_Unterberg@p4.f36.n245.z2.fidonet.org (Norbert Unterberg) (05/06/91)

 >   1)   Is there a way to activate (start up) one application (that is NOT
 >        currently running), and then terminate it FROM another application
 >        that is currently running ?
 >
 >   For example:   I have applications X, Y and Z. X is currently running and
 >                  wants Y or Z to start running, perform a task and then
 >                  terminate.

Yes, there is. First X trys to establish a DDE connection to Y. If Y does not 
answer, you start it using the WinExec or LoadModule command. That also makes Y 
the active window. After that, the DDE link between X and Y should work. X 
tells Y what to do, and after the processing X terminates Y (also by a DDE 
command).
A window (Y) thar receices (DDE-) messages does not automatically popup. It has 
to make itself the active window. If Y has finished its job, it can either tell 
it X, so X can popup again (via SetActiveWindow), or it can terminate or 
SetActiveWindow(x) itself.

Norbert, 2:245/36.4

Randy_Humes@f117.n151.z1.fidonet.org (Randy Humes) (05/09/91)

Two years ago I did what you described under Win2.0.  I started an invisible
core app that launched other apps.  All talked DDE.  When an app recieved the 
approriate(my def) DDE msg, it would close itself.  Data was passed between 
using shared global handles locked low.  The biggest problem was
keeping apps in synch and error handling.

James_Bell@f6.n3601.z1.fidonet.org (James Bell) (05/10/91)

>  I have applications X, Y and Z. X is currently running
>  and wants Y or Z to start running, perform a task and then
>  end.

Could you just use WinExec() to start the task, then do a 
SendMessage(hwndDyingTask, WM_CLOSE, NULL, NULL); ?
Hope that helps!
JB