here is what i want to accomplish:
create a windows service in PB
1) to start console EXE {program1} (by another language) in background without CMD window;
2) to loop and check if program1 is running or not periodically, if not, restart it;
code here:
Code: Select all
prog = RunProgram(MY_PROGRAM_NAME, "","",#PB_Program_Hide|#PB_Program_Open|#PB_Program_Read)
PrintN("prog=" + Str(prog))
If IsProgram(prog)
PrintN("isProgram=true")
pid = ProgramID(prod)
PrintN("pid=" + Str(pid))
Else
PrintN("not a program")
Return false
EndIf
If !ProgramRunning(pid)
;restart it
EndIf
appreciate any help