Files
HandWritten-Analisys/部署版本/wei服务-监控文件夹/Main.cpp
yannsy 5d96fe81b6 小修改
小修改,文件名的改进
2017-05-17 20:57:37 +08:00

48 lines
785 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#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;
}