Click here to Skip to main content
15,914,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionretain items in the list control Pin
jokefake21-Jul-06 2:16
jokefake21-Jul-06 2:16 
AnswerRe: retain items in the list control Pin
_AnsHUMAN_ 21-Jul-06 2:28
_AnsHUMAN_ 21-Jul-06 2:28 
GeneralRe: retain items in the list control Pin
jokefake21-Jul-06 3:22
jokefake21-Jul-06 3:22 
GeneralRe: retain items in the list control Pin
_AnsHUMAN_ 21-Jul-06 3:28
_AnsHUMAN_ 21-Jul-06 3:28 
QuestionRe: retain items in the list control Pin
David Crow21-Jul-06 3:30
David Crow21-Jul-06 3:30 
GeneralRe: retain items in the list control Pin
Hamid_RT21-Jul-06 4:03
Hamid_RT21-Jul-06 4:03 
QuestionActive X Pin
sheshidar21-Jul-06 2:16
sheshidar21-Jul-06 2:16 
QuestionUnable to Read Message Using Mapi Pin
Uday Janaswamy21-Jul-06 1:57
Uday Janaswamy21-Jul-06 1:57 
Hi all,

I am able to Read only one Message Using MapiFindNext(...) and MapiReadMail(...) Please let me know where i have gone wrong.

//==========================================================================

HINSTANCE hMapi; //Instance handle of the MAPI dll
hMapi = LoadLibrary(_T("MAPI32.DLL"));
LPMAPILOGON MAPILogon; //MAPILogon function pointer
LPMAPILOGOFF MAPILogoff; //MAPILogoff function pointer
LPMAPISENDMAIL MAPISendMail; //MAPISendMail function pointer
LPMAPIRESOLVENAME MAPIResolveName; //MAPIResolveName function pointer
LPMAPIFREEBUFFER MAPIFreeBuffer; //MAPIFreeBuffer function pointer
LPMAPIFINDNEXT MAPIFindNext;
LPMAPIREADMAIL MAPIReadMail;


MAPILogon = (LPMAPILOGON) GetProcAddress(hMapi, "MAPILogon");
MAPILogoff = (LPMAPILOGOFF) GetProcAddress(hMapi, "MAPILogoff");
MAPISendMail = (LPMAPISENDMAIL) GetProcAddress(hMapi, "MAPISendMail");
MAPIResolveName = (LPMAPIRESOLVENAME) GetProcAddress(hMapi, "MAPIResolveName");
MAPIFreeBuffer = (LPMAPIFREEBUFFER) GetProcAddress(hMapi, "MAPIFreeBuffer");
MAPIFindNext = (LPMAPIFINDNEXT) GetProcAddress(hMapi, "MAPIFindNext");
MAPIReadMail = (LPMAPIREADMAIL) GetProcAddress(hMapi, "MAPIReadMail");



ULONG err;
LHANDLE lhSession; // Need a session for MAPIFindNext.
CHAR rgchMsgID[513]; // Message IDs should be >= 512 CHARs + a null.
MapiMessage *lpMessage; // Used to get a message back from MAPIReadMail.
int i; // Ubiquitous loop counter.
int totalLength; // Number of characters printed on a line.
err = MAPILogon(0L,"MicrosoftExchangeServer",NULL,0L, 0L, & lhSession); // Session handle.
if (err != SUCCESS_SUCCESS) // Make sure MAPILogon succeeded.
MessageBox("Error: could not log on");

do
{
err = MAPIFindNext(lhSession, // explicit session required
0L, // always valid ulUIParam
NULL, // NULL specifies interpersonal messages
NULL, // seed message ID; NULL=get first NULL,
MAPI_LONG_MSGID, //MAPI_LONG_MSGID |
0L, // reserved; must be 0
rgchMsgID); // buffer to get back a message ID.

// retrieve the message
err = MAPIReadMail(lhSession, // Explicit session required.
0L, // Always valid ulUIParam.
rgchMsgID, // The message found by MAPIFindNext.
MAPI_SUPPRESS_ATTACH, // TO DO: handle attachments.
0L, // Reserved; must be 0.
&lpMessage); // Location of the returned message.
if(err != SUCCESS_SUCCESS) // Make sure MAPIReadMail succeeded.
{
MessageBox("Error");
}

if((lpMessage->lpOriginator->lpszName != NULL) && lpMessage->lpOriginator->lpszName[0] != '\0')
AfxMessageBox(lpMessage->lpOriginator->lpszName);
else
AfxMessageBox(lpMessage->lpOriginator->lpszAddress);
}while(err == SUCCESS_SUCCESS);

//=========================================================================


uday.
AnswerRe: Unable to Read Message Using Mapi Pin
Hamid_RT21-Jul-06 2:10
Hamid_RT21-Jul-06 2:10 
QuestionRe: Unable to Read Message Using Mapi Pin
David Crow21-Jul-06 2:44
David Crow21-Jul-06 2:44 
QuestionCImage in ActiveX - problem with close application Pin
majco33321-Jul-06 1:34
majco33321-Jul-06 1:34 
AnswerRe: CImage in ActiveX - problem with close application [modified] Pin
Hamid_RT21-Jul-06 2:00
Hamid_RT21-Jul-06 2:00 
GeneralRe: CImage in ActiveX - problem with close application Pin
majco33321-Jul-06 2:08
majco33321-Jul-06 2:08 
GeneralRe: CImage in ActiveX - problem with close application Pin
Hamid_RT21-Jul-06 3:55
Hamid_RT21-Jul-06 3:55 
GeneralRe: CImage in ActiveX - problem with close application Pin
majco33321-Jul-06 4:36
majco33321-Jul-06 4:36 
AnswerRe: CImage in ActiveX - problem with close application Pin
majco33323-Jul-06 23:17
majco33323-Jul-06 23:17 
QuestionTabControl FillToRight doesn`t work! Pin
leitman21-Jul-06 1:18
leitman21-Jul-06 1:18 
AnswerRe: TabControl FillToRight doesn`t work! Pin
Hamid_RT27-Jul-06 7:27
Hamid_RT27-Jul-06 7:27 
QuestionOPENFILENAME question Pin
atimpoo21-Jul-06 0:58
atimpoo21-Jul-06 0:58 
AnswerRe: OPENFILENAME question /*modified*/ Pin
Hamid_RT21-Jul-06 1:50
Hamid_RT21-Jul-06 1:50 
GeneralRe: OPENFILENAME question /*modified*/ Pin
toxcct21-Jul-06 2:35
toxcct21-Jul-06 2:35 
GeneralRe: OPENFILENAME question Pin
Hamid_RT21-Jul-06 3:53
Hamid_RT21-Jul-06 3:53 
AnswerRe: OPENFILENAME question Pin
David Crow21-Jul-06 3:08
David Crow21-Jul-06 3:08 
AnswerRe: OPENFILENAME question Pin
ThatsAlok21-Jul-06 3:11
ThatsAlok21-Jul-06 3:11 
AnswerRe: OPENFILENAME question Pin
Hamid_RT21-Jul-06 3:52
Hamid_RT21-Jul-06 3:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.