I've modified my program to skip the error when encountered. The program can run till end and scan all folders under My Folder (0x00001008). And it encounters two "-4, KErrNoMemory" errors while accessing the sub folders. After comparing it with the counting in Messaging, I realized that those are two folders with most messages stored, over 3000.
Moreover, now the phone is unable to list the counts of those two folders.
The saving plan might go like this way:
1. archive all accessible messages
2. remove them
3. hopefully those two largest folders can be reopen.
If #3 doesn't work, plan B go this way:
4. try to scan and archive all messages without accessing the parent folder (if possible).
Hope this would be done soon.
p.s. I really doubt if there is any message rescue applications for Symbian out in the market...