書いてみましたがきっと重たいと思うのであんまり多用するべきではありません。
HSPでなければOpenProcessをフックするのが一番でしょうが。
#uselib "kernel32"
#func OpenProcess "OpenProcess" int, int, int
#func CloseHandle "CloseHandle" int
#uselib "psapi"
#func EnumProcesses "EnumProcesses" int, int, int, int
#func EnumProcessModules "EnumProcessModules" int, int, int, int
#func GetModuleFileNameEx "GetModuleFileNameExA" int, int, int, int
#define PROCESS_ALL_ACCESS $001F0FFF
dim pids, 1024
dim opids, 1024
sdim file_name, 256
title "2秒毎に新規プロセスを検出"
mes "execute any process now."
repeat
gosub *enum_process
wait 200
loop
*enum_process
EnumProcesses varptr(pids), length(pids) * 4, 0
if __cashed {
repeat length(pids)
i = cnt
matched = 0
repeat length(opids)
if pids.i == opids.cnt {
matched = 1
break
}
loop
if matched : continue
OpenProcess PROCESS_ALL_ACCESS, 0, pids.i
hpro = stat
hmod = 0
EnumProcessModules hpro, varptr(hmod), 4, 0
GetModuleFileNameEx hpro, hmod, varptr(file_name), 256
CloseHandle hpro
mes file_name
loop
} else {
__cashed = 1
}
memcpy opids, pids, length(pids) * 4
return