how to read read all SMS msgs

how to read read all SMS msgs

Post by mazz » Tue, 17 Aug 2004 17:33:39

I would like to read all the messages in Inbox.
But I can't read more than 10 messages because QueryRows can set up to only
10 rows
How can i read all the messages?

My code is like this:
pSession->GetMsgStoresTable(MAPI_UNICODE, &m_pMsgStoresTable);

SizedSPropTagArray(2, Columns) = {2,{PR_DISPLAY_NAME,PR_ENTRYID}};
hRes = m_pMsgStoresTable->SetColumns((LPSPropTagArray)&Columns, 0);

while( true )
hRes = m_pMsgStoresTable->QueryRows(1, 0, &pRows);
if( FAILED( hRes ) || pRows->cRows != 1 ) break;
LPSPropValue lpProp = &pRows->aRow[0].lpProps[0];
if( _tcscmp( lpProp->Value.LPSZ, _T("SMS") ) == 0 ) break;
hRes = pSession->OpenMsgStore(0, pRows->aRow[0].lpProps[1].Value.bin.cb,
(ENTRYID*)pRows->aRow[0].lpProps[1].Value.bin.lpb, NULL, MDB_NO_DIALOG |

static SizedSPropTagArray(1, sContents) = { 1, {

hRes = pMsgStore->GetReceiveFolder(NULL,0,&cbEntryID,&lpEntryID,NULL );
hRes = pMsgStore->OpenEntry(cbEntryID,lpEntryID,NULL,0,&ulObjType,(LPUNKNOWN
FAR *)&lpFolder);
hRes = lpFolder->GetContentsTable( 0, &lpTable );

lpTable->GetRowCount(0,&numberOfMessages); // The number of messages;
hRes = lpTable->SetColumns( (LPSPropTagArray)&sContents, 0 );
hRes = lpTable->QueryRows( numberOfMessages, 0, &pRows );

for(int k=0;k<numberOfMessages;k++){

hRes = pMsgStore->OpenEntry( pRows->aRow[k].lpProps[0].Value.bin.cb,
(LPUNKNOWN FAR *)&lpMessage);

SizedSPropTagArray(1,rgTags_SENDER) = {1,PR_SENDER_NAME};
hRes = lpMessage->GetProps((LPSPropTagArray) &rgTags_SENDER, MAPI_UNICODE,
&pcount, &rgprops);

SizedSPropTagArray(1,rgTags_SUBJECT) = {1,PR_SUBJECT};
hRes = lpMessage->GetProps((LPSPropTagArray) &rgTags_SUBJECT, MAPI_UNICODE,
&pcount, &rgprops);

add(new SmsMessage(senderID, subject ));


how to read read all SMS msgs

Post by Peter Foot » Tue, 17 Aug 2004 19:05:37

Further calls to QueryRows will advance through the collection. So you can
read as many times as is necessary until you reach the end of the table in
blocks of up to 10 rows at a time.


Peter Foot
Windows Embedded MVP |

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!


how to read read all SMS msgs

Post by mazz » Tue, 17 Aug 2004 20:26:57

I didn't got it yet...
What should I use to put it concretely?



how to read read all SMS msgs

Post by mazz » Wed, 18 Aug 2004 16:56:52


"Peter Foot [MVP]" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...

I haven't understood the collection.
But if i include Afxtempl.h or Afxcoll.h to use collection class as a trial
, EVC complains ...

c:\program files\windows ce tools\wce420\pocket pc
2003\mfc\include\wcealt.h(236) : error C2084: function 'void *__cdecl
operator new(unsigned int,void *)' already has a body

I am using string class to store senderID and subject.
I think string class and MFC are exclusive.