CProcessDlg pro;
CImportWorker worker;
worker.m_pConnection = m_pConnection;
worker.m_pRecordSet = m_pRecordSet;
pro.worker = &worker;
CString strFileName, strTemp;
CString strSysPath;
char szSystemPath[MAX_PATH];
CStdioFile fileSystemINI;
// 取得系统盘符
if(GetWindowsDirectory(szSystemPath,MAX_PATH)==0)
{
::MessageBox(NULL,"Windows System Damaged!","DPL Error",MB_ICONSTOP);
return ;
}
strFileName.Format("%s\\SL6000DPL.ini", szSystemPath);
if(!fileSystemINI.Open(strFileName,CFile::modeRead | CFile::typeText | CFile::shareDenyNone))
{
::MessageBox(NULL,"SL6000DPL Information File Damaged!","DPL Error",MB_ICONSTOP);
return ;
}
// 读出程序运行目录
fileSystemINI.ReadString(strTemp);
if(strTemp != "[Program]")
{
::MessageBox(NULL,"SL6000DPL Information File Format Error!","DPL Error",MB_ICONSTOP);
fileSystemINI.Close();
return ;
}
fileSystemINI.ReadString(strTemp);
int nPos = strTemp.Find('=');
if(nPos == -1)
{
::MessageBox(NULL,"SL6000DPL Information File Format Error!","DPL Error",MB_ICONSTOP);
fileSystemINI.Close();
return ;
}
nPos = strTemp.GetLength() - nPos - 1; strSysPath = strTemp.Right(nPos);
fileSystemINI.Close();
CString strWorkPath;
strFileName = strSysPath + "\\DPL-TOOL-20221103.dat";
CFile TempFile;
if(!TempFile.Open(strFileName, CFile::modeRead ) ) //open file
{
::MessageBox(NULL,"Can not find well information file! Please creat well information file first!","DPL Error",MB_ICONSTOP);
return;
}
else
{
AfxMessageBox("a");
CWinThread *m_pThread = AfxBeginThread((AFX_THREADPROC)importData, (LPVOID)&pro);
AfxMessageBox("b");
TempFile.Close();
}