Click here to Skip to main content
15,849,182 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionretain items in the list control Pin
jokefake21-Jul-06 3:16
jokefake21-Jul-06 3:16 
AnswerRe: retain items in the list control Pin
_AnsHUMAN_ 21-Jul-06 3:28
_AnsHUMAN_ 21-Jul-06 3:28 
GeneralRe: retain items in the list control Pin
jokefake21-Jul-06 4:22
jokefake21-Jul-06 4:22 
GeneralRe: retain items in the list control Pin
_AnsHUMAN_ 21-Jul-06 4:28
_AnsHUMAN_ 21-Jul-06 4:28 
QuestionRe: retain items in the list control Pin
David Crow21-Jul-06 4:30
David Crow21-Jul-06 4:30 
GeneralRe: retain items in the list control Pin
Hamid_RT21-Jul-06 5:03
Hamid_RT21-Jul-06 5:03 
QuestionActive X Pin
sheshidar21-Jul-06 3:16
sheshidar21-Jul-06 3:16 
QuestionUnable to Read Message Using Mapi Pin
Uday Janaswamy21-Jul-06 2:57
Uday Janaswamy21-Jul-06 2: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 3:10
Hamid_RT21-Jul-06 3:10 
QuestionRe: Unable to Read Message Using Mapi Pin
David Crow21-Jul-06 3:44
David Crow21-Jul-06 3:44 
QuestionCImage in ActiveX - problem with close application Pin
majco33321-Jul-06 2:34
majco33321-Jul-06 2:34 
AnswerRe: CImage in ActiveX - problem with close application [modified] Pin
Hamid_RT21-Jul-06 3:00
Hamid_RT21-Jul-06 3:00 
GeneralRe: CImage in ActiveX - problem with close application Pin
majco33321-Jul-06 3:08
majco33321-Jul-06 3:08 
GeneralRe: CImage in ActiveX - problem with close application Pin
Hamid_RT21-Jul-06 4:55
Hamid_RT21-Jul-06 4:55 
GeneralRe: CImage in ActiveX - problem with close application Pin
majco33321-Jul-06 5:36
majco33321-Jul-06 5:36 
AnswerRe: CImage in ActiveX - problem with close application Pin
majco33324-Jul-06 0:17
majco33324-Jul-06 0:17 
QuestionTabControl FillToRight doesn`t work! Pin
leitman21-Jul-06 2:18
leitman21-Jul-06 2:18 
AnswerRe: TabControl FillToRight doesn`t work! Pin
Hamid_RT27-Jul-06 8:27
Hamid_RT27-Jul-06 8:27 
QuestionOPENFILENAME question Pin
atimpoo21-Jul-06 1:58
atimpoo21-Jul-06 1:58 
AnswerRe: OPENFILENAME question /*modified*/ Pin
Hamid_RT21-Jul-06 2:50
Hamid_RT21-Jul-06 2:50 
GeneralRe: OPENFILENAME question /*modified*/ Pin
toxcct21-Jul-06 3:35
toxcct21-Jul-06 3:35 
GeneralRe: OPENFILENAME question Pin
Hamid_RT21-Jul-06 4:53
Hamid_RT21-Jul-06 4:53 
AnswerRe: OPENFILENAME question Pin
David Crow21-Jul-06 4:08
David Crow21-Jul-06 4:08 
AnswerRe: OPENFILENAME question Pin
ThatsAlok21-Jul-06 4:11
ThatsAlok21-Jul-06 4:11 
AnswerRe: OPENFILENAME question Pin
Hamid_RT21-Jul-06 4:52
Hamid_RT21-Jul-06 4: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.