I have the following codes:
void CLOGFILE_INTERPRETERDlg::OnBtnLoad()
{
AfxGetModuleState()->m_dwVersion = 0x0601; //corrects the differences in MS DAO
UpdateData();
m_Loading = _T("Loading...");
UpdateData(FALSE);
UpdateData(TRUE);
//UpdateData();
int length = 0;
try {
char strFilter[] = { "Log Files (*.log)|*.log|All Files (*.*)|*.*||" };
CFileDialog FileDlg(TRUE, ".log", NULL, 0, strFilter);
if ( FileDlg.DoModal() == IDOK) {
CString szlstfile = FileDlg.GetPathName(); // This is your selected file name with path
m_FileName = szlstfile; AfxBeginThread(Parse,NULL,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
} catch (long) {
MessageBox("Log file cannot be loaded!!!","LOADING UNSUCCESSFUL",MB_OK|MB_ICONERROR);
}
m_Loading = _T("Done");
UpdateData(FALSE);
m_TreeView.EnableWindow(FALSE);
}
CString CLOGFILE_INTERPRETERDlg::Convert(CString temp)
{
AfxGetModuleState()->m_dwVersion = 0x0601; //corrects the differences in MS DAO
Code code;
int group = 0;
int startIndex = 0;
int endIndex = 0;
CString get;
CString temp2;
CString converted;
CString translated = "";
for ( int index = 0; index <= temp.GetLength(); index++ ) {
if ( temp.Mid(index, 3) == "(0)" && group <= 0 ) {
translated = translated + temp.Mid(index, 3);
index = index + 2;
} else if ( temp.Mid(index, 1) == "(" ) {
group++;
translated = translated + temp.Mid(index, 1);
if ( temp.Mid(index + 1, 1) == "0" ) {
startIndex = index + 1;
endIndex = 0;
for ( int index2 = index + 1; index2 <= temp.GetLength(); index2++ ) {
if ( temp.Mid(index2, 1) == "(" || temp.Mid(index2, 1) == ")" ) {
index2 = temp.GetLength();
} else {
endIndex++;
}
}
converted = code.Convert(temp.Mid(startIndex, endIndex), get);
translated = translated + converted;
index = index + endIndex;
}
} else if ( temp.Mid(index, 1) == ")" ) {
group--;
translated = translated + temp.Mid(index, 1);
} else if ( temp.Mid(index, 3) == "res" || temp.Mid(index, 3) == "req" ) {
get = temp.Mid(index, 3);
translated = translated + temp.Mid(index, 1);
} else {
translated = translated + temp.Mid(index, 1);
}
}
return translated;
}
UINT CLOGFILE_INTERPRETERDlg::Parse( LPVOID Param ) {
CStdioFile source;
CStdioFile destination;
source.Open(_T (m_FileName), CFile::modeReadWrite);
destination.Open(_T ("C:/converted.txt"), CFile::modeReadWrite);
char str[300];
int range = 0;
while(source.ReadString(str, 300)) {
CString temp = "";
CString translated = "";
temp = temp + str;
if ( temp.Find("(0.") > 0 ) {
int pair = 0;
repeat:
for ( int index = 0; index < temp.GetLength(); index++ ) {
if ( temp.Mid(index, 1) == "(" ) {
pair++;
} else if ( temp.Mid(index, 1) == ")" ) {
pair--;
}
}
if ( pair != 0 ) {
source.ReadString(str, 300);
temp.TrimRight(" ");
temp.TrimRight("\n");
temp = temp + str;
pair = 0;
goto repeat;
}
//destination.Open(_T ("C:/converted.txt"), CFile::modeReadWrite);
translated = Convert(temp);
} else {
translated = temp;
}
temp;
destination.WriteString(translated);
}
destination.Close();
source.Close();
return true;
}
When I compile the program, I always got this error message:
C:\LOGFILE_INTERPRETER\LOGFILE_INTERPRETERDlg.cpp(355) : error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'
Error executing cl.exe.
Does anyone knows what is the problem with my codes?