Ok this is the code that is being used to check if the program is running:
=ddesetoption( "SAFETY", .f.)
*Check to see if DDE service was already started.
achan = ddeinitiate( "pkf4", "System" )
IF achan # -1
WAIT WINDOW "Application is already running. It may take a few seconds to load so please be patient."
QUIT
ENDIF
*If we got here, the service was not started, so start it.
=ddesetservice( "pkf4", "DEFINE" )
I do some stuff from the menu of the app and in the end after user click on a msgBox I issue the following command to restart the program, but something is wrong in this.
if
.......
msgbox(......)
achan = DDETerminate("pk4"

clear events
Clear all
Close all
RUN /N ianera.EXE
endif