Read-only archive of the All About Symbian forum (2001–2013) · About this archive

How to use CCntFilter provided in Contact Model?

2 replies · 2,038 views · Started 25 July 2004

I deleted all contacts by mistake and I want to write a program to un-delete them.

Here's my code:
{
CContactDatabase* pCD = CContactDatabase::OpenL();
CleanupStack::PushL(pCD);

CCntFilter* pCntFilter = CCntFilter::NewLC();
pCntFilter->Reset();
pCD->FilterDatabaseL(*pCntFilter); // CRASH
CleanupStack::PopAndDestroy(); // pCntFilter
CleanupStack::PopAndDestroy(); // pCD
}

If I remove the line "pCD->FilterDatabaseL(*pCntFilter);",
the code will exit normally.

I was puzzled by the method FilterDatabaseL().
What's wrong with my code?
Anyone knows?
Thanks!

hoyle wrote:I deleted all contacts by mistake and I want to write a program to un-delete them.

Here's my code:
{
CContactDatabase* pCD = CContactDatabase::OpenL();
CleanupStack::PushL(pCD);

CCntFilter* pCntFilter = CCntFilter::NewLC();
pCntFilter->Reset();
pCD->FilterDatabaseL(*pCntFilter); // CRASH
CleanupStack::PopAndDestroy(); // pCntFilter
CleanupStack::PopAndDestroy(); // pCD
}

If I remove the line "pCD->FilterDatabaseL(*pCntFilter);",
the code will exit normally.

I had a similar problem, i just wanted to list the entries in the contact database. I used a .exe with very similar code. The phone blocked at the FilterDatabaleL call. I don't know the exact place of the error, but I think it has to do with the ActiveScheduler. .exe programs don't have an ActiveScheduler installed when they run (.app programs do), so i installed one myself, but forgot to start it. I think the program is just waiting for the ActiveScheduler to start.

Hope this helps,
evolux

Hi

Have you solved the problem. I have the same problem and the code works fine on Nokia phones.

If you have solved the problem, can you please share it 😊

Thanks
Venkatesh

[email][email protected][/email]