Message passing would probably not always work because Clearwin program may hang somewhere and be nonresponsive...
The whole trick can be easily done this way
i=start_process@('tasklist >ZZZZZ,' ')
i=start_process@('taskkill /pid 270772',' ')
(where 270772 is an example of process ID or PID found by first command, and ZZZZZ the file where PIDs are written and then read to fortran program).
But by some reason start_process@ works strange way.
i=start_process@('tasklist >ZZZZZ,' ')
does not write anything to file ZZZZZ. Though kills process fine if tell it PID manually. Even such DIR command does not work
use clrwin
INTEGER i, START_PROCESS@
i = START_PROCESS@('dir > ZZZZZ',' ')
end
Any idea why? The bug? The WinExec command
i = WinExec('tasklist /v >zzzzzz',0)
also produces empty zzzzz file. The only subroutine which works is
call cissue@('tasklist /v >zzzzz',ifail)
Whole 'killing' code is 40 lines. Though I would prefer to see all this done more elegant way - not to write process list to the disk and read it from there into program to find PID but use WinAPI.
Problem is that Salford's Winapi does not have of normal description of arguments of Winapi functions suitable for Fortran user. What info one can get from this description of TerminateProcess fror example?
STDCALL TERMINATEPROCESS 'TerminateProcess' (VAL,VAL):LOGICAL*4 or
STDCALL GETSYSTEMINFO 'GetSystemInfo' (REF) ???
That makes the use of WinAPI with Salford FTN95 a plain pure hell.
Can anyone send me the Intel/Compaq/DEC fortran Winapi description, I lost it somewhere and also lazy to search for compiler CD and install it ?
The whole solution is now elevated to 3 beers 😃