Cecil
19+ years progress programming and still learning.
This is a simple test using .NET to see if a process is already running. Before, I was using tasklist command and then parsing the output. This code could be adapted to include more information. However, I have not figured out how to cast a .NET array to an ABL extent yet.
Code:
USING System.Diagnostics.*.
FUNCTION isProcessExist RETURNS LOGICAL (INPUT processName AS CHARACTER):
DEFINE VARIABLE strArr AS CLASS System.Collections.IList NO-UNDO.
DEFINE VARIABLE sysProcesses AS CLASS "System.Diagnostics.PROCESS[]".
sysProcesses = System.Diagnostics.Process:GetProcessesByName(INPUT processName).
RETURN LOGICAL( sysProcesses:LENGTH ).
END FUNCTION.
MESSAGE isProcessExist("notepad").