The LoadTaskResult() method of the CkEmailBundle class is throwing an access violation exception. Any ideas why an access violation exception is being thrown?
The following code sample works fine:
mailman.put_MailHost(Pop3HostName.c_str());
mailman.put_PopUsername(Pop3UserName.c_str());
mailman.put_PopPassword(Pop3Password.c_str());
CkEmailBundle *bundle = 0;
bundle = mailman.CopyMail();
The following code sample throws an Access Violation Exception
mailman.put_MailHost(Pop3HostName.c_str());
mailman.put_PopUsername(Pop3UserName.c_str());
mailman.put_PopPassword(Pop3Password.c_str());
// Call the async version of the CopyMail method to return a task object.
// The task object is loaded, but is in the Inert state -- meaning it is
// not yet scheduled to run on Chilkat's background thread pool.
CkTask *task = mailman.CopyMailAsync();
if (task == 0)
{
cout << mailman.lastErrorText() << "\r\n";
return (1);
}
// Schedule the task for running on the thread pool. This changes the task's state
// from Inert to Live.
bool success = task->Run();
if (success != true)
{
std::cout << task->lastErrorText() << endl;
delete task;
return (1);
}
int curPctDone = 0;
int sleep_cnt = 0;
while (task->get_Finished() != true && sleep_cnt<120)
{
if (task->get_PercentDone() != curPctDone) {
curPctDone = task->get_PercentDone();
std::cout << curPctDone << " percent done" << "\r\n";
}
// Sleep 1000 ms.
task->SleepMs(1000);
sleep_cnt++;
}
if (task->get_StatusInt() != 7)
{
std::cout << "Task did not complete." << "\r\n";
std::cout << "task status: " << task->status() << "\r\n";
delete task;
return (1);
}
CkEmailBundle *bundle = 0;
success = bundle->LoadTaskResult(*task);