|
아래는 RealTime_Check를 클릭했을 때,
Program_List.txt 파일을 읽어들여서 해당 라인만큼의
ShellExecute API를 반복수행시키고자 작성한 것입니다.
그런데, 텍스트 파일 내용이
파일 내용1) ".txt" 형태의 파일인 경우에는 모두 정상적으로 수행되는데
- TelNet.exe 파일은 뮤텍스를 이용하여 반복수행되지 않도록 작성)
C:\\Temp\\TelNet.exe(또는 C:\Temp\TelNet.exe)
C:\Temp\ProgramCheck\List1.txt
파일 내용2) ".exe" 형태의 실행파일이 포함되면 에러가 나옵니다.
C:\Temp\List1.txt
C:\Temp\List2.txt
C:\Temp\ProgramCheck\List1.txt
C:\Temp\ProgramCheck\List2.txt
-----------------------------------------------------------------------------------
void __fastcall TForm1::RealTime_CheckClick(TObject *Sender)
{
TStringList *Check_List = new TStringList(); // 검색문자열
Check_List->LoadFromFile("C:\\Temp\\ProgramCheck\\Program_List.txt");
for (int i=0;Check_List->Count; i++)
ShellExecute(Handle, "open", Check_List->Strings[i].c_str(), NULL,
NULL, SW_SHOW);
delete Check_List;
}
-----------------------------------------------------------------------------------
답변에 미리 감사드립니다.
|