ptrennum
asked on
Cannot Convert from CProgressWnd to CProgressWnd
I have a recursive function that takes a parameter of CProgressWnd. In the middle of the function there is a call to itself:
RetrieveFileNamesFrom(AddP ath,backup Log,wndPro gress);
It throws the error mentioned in the question title. I'm not sure why it would have a problem converting from itself to itself?? Anyone know why this is?
PT
RetrieveFileNamesFrom(AddP
It throws the error mentioned in the question title. I'm not sure why it would have a problem converting from itself to itself?? Anyone know why this is?
PT
ptrennum,
Also, please post the class declaration for CProgressWnd.
David Maisonave :-}
Also, please post the class declaration for CProgressWnd.
David Maisonave :-}
ASKER
Error:
error C2664: 'CZip::RetrieveFileNamesFr om' : cannot convert parameter 3 from 'CProgressWnd' to 'CProgressWnd'
DEclaration:
CProgressWnd wndProgress(this, "Progress", TRUE);
PT
error C2664: 'CZip::RetrieveFileNamesFr
DEclaration:
CProgressWnd wndProgress(this, "Progress", TRUE);
PT
Please post the class declaration for CProgressWnd.
Particularly the constructors for class CProgressWnd.
Also please post the code for function 'CZip::RetrieveFileNamesFr om'
Particularly the constructors for class CProgressWnd.
Also please post the code for function 'CZip::RetrieveFileNamesFr
ASKER
CProgressWnd::CProgressWnd ()
{
CommonConstruct();
}
CProgressWnd::CProgressWnd (CWnd* pParent, LPCTSTR pszTitle, BOOL bSmooth /* = FALSE */)
{
CommonConstruct();
m_strTitle = pszTitle;
Create(pParent, pszTitle, bSmooth);
}
void CProgressWnd::CommonConstr uct()
{
m_wRenenableWnd = NULL;
m_nNumTextLines = 4;
m_nPrevPos = 0;
m_nPrevPercent = 0;
m_nStep = 1;
m_nMinValue = 0;
m_nMaxValue = 100;
m_strTitle = _T("Progress");
m_strCancelLabel = _T(" Cancel ");
m_bCancelled = FALSE;
m_bModal = FALSE;
m_bPersistantPosition = TRUE; // saves and restores position automatically
}
DWORD CZip::RetrieveFileNamesFro m(char *Path, CFile backupLog,CProgressWnd wndProgress)
{
HANDLE findHndl;
char FilePath[MAX_PATH], SrchPath[MAX_PATH], AddPath[MAX_PATH];
WIN32_FIND_DATA fileInfo;
DWORD ls;
static const char newLine[] = "\r\n";
FilePath[0]=0;
if (Path[0] != '\\' && Path[1] != ':')
{
GetCurrentDirectory(MAX_PA TH, FilePath);
ls=strlen(FilePath);
if (ls != 0)
ls--;
if (FilePath[ls] != '\\')
strcat(FilePath, "\\");
}
strcat(FilePath, Path);
ls=strlen(FilePath);
if (ls != 0)
ls--;
if (FilePath[ls] != '\\')
{
if ((findHndl=FindFirstFile(F ilePath, &fileInfo)) != INVALID_HANDLE_VALUE)
{
if ((fileInfo.dwFileAttribute s&FILE_ATT RIBUTE_DIR ECTORY) != FILE_ATTRIBUTE_DIRECTORY)
{
backupLog.Write(FilePath, lstrlen(FilePath));
backupLog.Write(newLine, lstrlen(newLine));
AddNameToList(FilePath);
FindClose(findHndl);
return TRUE;
}
else
FindClose(findHndl);
}
strcat(FilePath, "\\");
}
strcpy(SrchPath, FilePath);
strcat(SrchPath, "*.*");
if ((findHndl=FindFirstFile(S rchPath, &fileInfo)) == INVALID_HANDLE_VALUE)
return FALSE;
do
{
sprintf(AddPath, "%s%s", FilePath, fileInfo.cFileName);
if (fileInfo.cFileName[0] != '.')
{
if ((fileInfo.dwFileAttribute s&FILE_ATT RIBUTE_DIR ECTORY) == FILE_ATTRIBUTE_DIRECTORY)
RetrieveFileNamesFrom(AddP ath,backup Log,wndPro gress);
else
{
backupLog.Write(AddPath, lstrlen(AddPath));
backupLog.Write(newLine, lstrlen(newLine));
AddNameToList(AddPath);
}
}
}
while(FindNextFile(findHnd l, &fileInfo) != 0);
FindClose(findHndl);
return TRUE;
}
{
CommonConstruct();
}
CProgressWnd::CProgressWnd
{
CommonConstruct();
m_strTitle = pszTitle;
Create(pParent, pszTitle, bSmooth);
}
void CProgressWnd::CommonConstr
{
m_wRenenableWnd = NULL;
m_nNumTextLines = 4;
m_nPrevPos = 0;
m_nPrevPercent = 0;
m_nStep = 1;
m_nMinValue = 0;
m_nMaxValue = 100;
m_strTitle = _T("Progress");
m_strCancelLabel = _T(" Cancel ");
m_bCancelled = FALSE;
m_bModal = FALSE;
m_bPersistantPosition = TRUE; // saves and restores position automatically
}
DWORD CZip::RetrieveFileNamesFro
{
HANDLE findHndl;
char FilePath[MAX_PATH], SrchPath[MAX_PATH], AddPath[MAX_PATH];
WIN32_FIND_DATA fileInfo;
DWORD ls;
static const char newLine[] = "\r\n";
FilePath[0]=0;
if (Path[0] != '\\' && Path[1] != ':')
{
GetCurrentDirectory(MAX_PA
ls=strlen(FilePath);
if (ls != 0)
ls--;
if (FilePath[ls] != '\\')
strcat(FilePath, "\\");
}
strcat(FilePath, Path);
ls=strlen(FilePath);
if (ls != 0)
ls--;
if (FilePath[ls] != '\\')
{
if ((findHndl=FindFirstFile(F
{
if ((fileInfo.dwFileAttribute
{
backupLog.Write(FilePath, lstrlen(FilePath));
backupLog.Write(newLine, lstrlen(newLine));
AddNameToList(FilePath);
FindClose(findHndl);
return TRUE;
}
else
FindClose(findHndl);
}
strcat(FilePath, "\\");
}
strcpy(SrchPath, FilePath);
strcat(SrchPath, "*.*");
if ((findHndl=FindFirstFile(S
return FALSE;
do
{
sprintf(AddPath, "%s%s", FilePath, fileInfo.cFileName);
if (fileInfo.cFileName[0] != '.')
{
if ((fileInfo.dwFileAttribute
RetrieveFileNamesFrom(AddP
else
{
backupLog.Write(AddPath, lstrlen(AddPath));
backupLog.Write(newLine, lstrlen(newLine));
AddNameToList(AddPath);
}
}
}
while(FindNextFile(findHnd
FindClose(findHndl);
return TRUE;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks - I haven't used it in the func yet but I will be.
PT
PT
Please post the exact error you're getting
David Maisonave :-)
Cheers!