I just created one using the suggestion of Hans. Works like a champion!
Oh, here is the main code.
, CStrings sAppPath sAppName.
StartProcess - , CreateProcess PID ( ). .
, , , . - c:\windows\ notepad.exe 10 .
#include <tlhelp32.h>
PROCESSENTRY32 pe32 = {0};
HANDLE hSnap;
int iDone;
int iTime = 60;
bool bProcessFound;
while(true)
{
hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
pe32.dwSize = sizeof(PROCESSENTRY32);
Process32First(hSnap,&pe32);
bProcessFound = false;
iDone = 1;
while(iDone)
{
iDone = Process32Next(hSnap,&pe32);
if (strcmp(pe32.szExeFile,sAppName) == 0)
{
bProcessFound = true;
iDone = 0;
}
}
if(!bProcessFound)
{
startProcess(sAppPath+sAppName,"");
}
Sleep(iTime*1000);
}