Dears:
A problem occurs in my application about
IOEFolderManager::GetNextFolder function. My application create 2
threads to get the spam mail folder in Windows mail. The main thread
can get the right spam folder. But another main thread can not get it.
Their code is most same.
The code in main thread:
com_ptr<TMAS_OEStore::IOEFolder> spFolder= m_spFolderMgr-
>GetFirstFolder();
bool bExist= false;
long lRootId= 0;
while(!spFolder.is_null()) {
CString strName= spFolder->Name().t_str().c_str();
if(strName == SPAMBUSTER_SPAMMAIL_FOLDERNAME) {
m_spSpamMail= spFolder;
bExist= true;
break;
} else if (strName == "Local Folders") {
lRootId= spFolder->GetID();
}
spFolder = m_spFolderMgr->GetNextFolder();
}
if (!bExist) {
CDebugMsg::Trace("@@@ Creating spam mail folder ...");
m_spSpamMail= m_spFolderMgr->CreateFolder(lRootId,
SPAMBUSTER_SPAMMAIL_FOLDERNAME);
CDebugMsg::Trace("@@@ spam mail folder was created.");
}
The code in another work thread:
spMailScanInfSet->spFolderMgr=
TMAS_OEStore::OEFolderManager::create();
CDebugMsg::Trace("Get the spam folder interface");
com_ptr<TMAS_OEStore::IOEFolder> spFolder= (spMailScanInfSet-
>spFolderMgr)->GetFirstFolder();
while(!spFolder.is_null()) {
CString strName= spFolder->Name().t_str().c_str();
if(strName == SPAMBUSTER_SPAMMAIL_FOLDERNAME) {
spMailScanInfSet->spSpamMail= spFolder;
break;
}
spFolder = (spMailScanInfSet->spFolderMgr)->GetNextFolder();
}
This case just happen in windows mail on vista platform. For
outlook express, it works well. And it seems that
IOEFolder::GetFirstMessage in other thead also has the same
problem(Always get null pointer). could you help me?
BRS
David