// TODO: 在此添加控件通知处理程序代码
GetDlgItem(IDC_EDIT_TXT)->GetWindowText(cstrTxt);
GetDlgItem(IDC_EDIT_COMPONENT)->GetWindowText(cstrComponent);
GetDlgItem(IDC_EDIT_UNISWITCH)->GetWindowText(cstrUniswitch);
if (cstrTxt.IsEmpty())
{
MessageBox(_T("文本地址为空!"));
GetDlgItem(IDC_EDIT_TXT)->SetFocus();
return;
}
else if (cstrComponent.IsEmpty())
{
MessageBox(_T("Component地址为空!"));
GetDlgItem(IDC_EDIT_COMPONENT)->SetFocus();
return;
}
else if (cstrUniswitch.IsEmpty())
{
MessageBox(_T("Uniswitch地址为空!"));
GetDlgItem(IDC_EDIT_UNISWITCH)->SetFocus();
return;
}
cstrTxt += _T("\\test.txt");
CFile file(cstrTxt,CFile::modeCreate | CFile::modeWrite);
HANDLE hFile = CreateFile(cstrTxt,GENERIC_READ||GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,0);
WIN32_FIND_DATA FFD;
BOOL Isfinished = FALSE;
cstrComponent += _T("//**");
hFile = FindFirstFile(cstrComponent,&FFD);
if( hFile == INVALID_HANDLE_VALUE )
{
return;
}
while(!Isfinished)
{
if( !FindNextFile(hFile,&FFD) )
{
if(GetLastError() == ERROR_NO_MORE_FILES)
{
Isfinished = TRUE;
}
}
TRACE(FFD.cFileName);
TRACE(_T("\n"));
strcat(FFD.cFileName,_T("\r\n"));
string strFileName;
strFileName = FFD.cFileName;
file.Write(strFileName.c_str(),strFileName.size());
}
FindClose(hFile);
GetDlgItem(IDC_EDIT_TXT)->GetWindowText(cstrTxt);
GetDlgItem(IDC_EDIT_COMPONENT)->GetWindowText(cstrComponent);
GetDlgItem(IDC_EDIT_UNISWITCH)->GetWindowText(cstrUniswitch);
if (cstrTxt.IsEmpty())
{
MessageBox(_T("文本地址为空!"));
GetDlgItem(IDC_EDIT_TXT)->SetFocus();
return;
}
else if (cstrComponent.IsEmpty())
{
MessageBox(_T("Component地址为空!"));
GetDlgItem(IDC_EDIT_COMPONENT)->SetFocus();
return;
}
else if (cstrUniswitch.IsEmpty())
{
MessageBox(_T("Uniswitch地址为空!"));
GetDlgItem(IDC_EDIT_UNISWITCH)->SetFocus();
return;
}
cstrTxt += _T("\\test.txt");
CFile file(cstrTxt,CFile::modeCreate | CFile::modeWrite);
HANDLE hFile = CreateFile(cstrTxt,GENERIC_READ||GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,0);
WIN32_FIND_DATA FFD;
BOOL Isfinished = FALSE;
cstrComponent += _T("//**");
hFile = FindFirstFile(cstrComponent,&FFD);
if( hFile == INVALID_HANDLE_VALUE )
{
return;
}
while(!Isfinished)
{
if( !FindNextFile(hFile,&FFD) )
{
if(GetLastError() == ERROR_NO_MORE_FILES)
{
Isfinished = TRUE;
}
}
TRACE(FFD.cFileName);
TRACE(_T("\n"));
strcat(FFD.cFileName,_T("\r\n"));
string strFileName;
strFileName = FFD.cFileName;
file.Write(strFileName.c_str(),strFileName.size());
}
FindClose(hFile);