Using DDE to Check If Another Windows Application Is Open

ID: Q108681

2.50 2.50a 2.50b WINDOWS kbinterop kbprg

The information in this article applies to:

When you are using dynamic data exchange (DDE) commands programmatically, there may be times when you have to determine if a session of an application is already running. DDESetOption() and DDEInitiate() can be used determine if a application is running or not.

For example, the following code determines if Microsoft Excel is already open:

   =DDESetOption("Safety",.f.)         && This turns off the message box
                                       && so that the program will
                                       && not be interrupted.
   openapp=DDEInitiate("Excel","System")

   IF openapp < 0                       && Any negative number returned
                                        && by DDEInitiate() means that a
                                        && channel could not be opened.
      RUN/N C:\EXCEL\EXCEL.EXE
   ENDIF

Additional reference words: VFoxWin 3.00 FoxWin 2.50 2.50a 2.50b KBCategory: kbinterop kbprg KBSubcategory: FxinteropDde
Keywords          : FxinteropDde 
Version           : 2.50 2.50a 2.50b
Platform          : WINDOWS

Last Reviewed: May 1, 1996