文件夹监控wei服务

伪服务
This commit is contained in:
yanshui177
2017-05-17 20:50:34 +08:00
parent 6dcd378738
commit e9f18bbc9b
11 changed files with 340 additions and 241 deletions

View File

@@ -0,0 +1,47 @@
#include "Main.h"
#include "Check.h"
using namespace std;
int main(int argc, char** argv)
{
//监控..\Check\路径下有没有新文件
char * path = "./Check/";
vector<string> files;
WriteToLog(GetTime());
WriteToLog("--开始运行服务--\n");
while(true)
{
//检查有没有新的文件若有则都在vector files中存储
CheckFile(path, files);
for (int iter = 0; iter < files.size();iter++)
{
// string cmd="D:/HWCV/config/HWCV-exe ";
// cmd += files[iter];
// WinExec((char*)cmd.c_str(),SW_HIDE);
try{
ShellExecute(NULL,"open",
"HWCV-exe.exe",
(char*)files[iter].c_str(),
NULL,
SW_SHOWNORMAL);
}catch(exception e)
{
}
}
files.clear();
Sleep(SLEEP_TIME);
}
WriteToLog(GetTime());
WriteToLog("--结束服务--\n");
return 1;
}