K
Hi !
Danke erstmal für die 2 links !
Ich hab nun nur ein Problem...
undzwar ist der erste link genau das was ich will !
Das Problem daran ist, dass es Speicher fehler verursacht...
Ich habe VC++ 6.0
Dies ist die für mich wichtige funktion die nen Speicher fehler verursacht (Nicht abgefangene Ausnahme in swap.exe: 0xC0000005: Access Violation.)
STDMETHODIMP CApp::cFindMessageID ( LPTSTR SeedMsgID, FLAGS flFlags, LPTSTR *prgchMsgID )
{
HRESULT hRes = S_OK;
ULONG ulReserved = 0L;
char rgchMsgID[MAX_MSGID];
hRes = m_MAPIFindNext (
m_lhSession, // Global session handle
0L, // Parent window. Set to 0 since console app
NULL, // NULL specifies interpersonal mail message
SeedMsgID, // Seed message ID; NULL == get first message
flFlags,
ulReserved, // Reserved. Must be 0L
rgchMsgID
);
if ( hRes == MAPI_E_NO_MESSAGES )
{
printf ( "No messages to print.\r\n" );
}
if ( hRes != SUCCESS_SUCCESS && hRes != MAPI_E_NO_MESSAGES )
{
printf ( "Call to MAPIFindNext failed due to error code %d.\r\n", hRes );
switch ( hRes )
{
case MAPI_E_FAILURE:
printf ( "One or more unspecified errors occurred while matching the message type. The call failed before message type matching could take place.\r\n" );
break;
case MAPI_E_INSUFFICIENT_MEMORY:
printf ( "There was insufficient memory to proceed. No message was found.\r\n" );
break;
case MAPI_E_INVALID_MESSAGE:
printf ( "An invalid message identifier was passed in the lpszSeedMessageID parameter. No message was found.\r\n" );
break;
case MAPI_E_INVALID_SESSION:
printf ( "An invalid session handle was passed in the lhSession parameter. No message was found.\r\n" );
break;
default:
printf ( "Unknown error code.\r\n" );
break;
}
}
else
{
MAPIAllocateBuffer (strlen ( rgchMsgID )+1, (LPVOID *) prgchMsgID );
strcpy ( *prgchMsgID, rgchMsgID );
}
return hRes;
}
Der fehler tritt hier auf:
strcpy ( *prgchMsgID, rgchMsgID );
Aufgerufen wird die funktion so:
if ( SUCCESS_SUCCESS == ( hRes = cFindMessageID ( NULL, MAPI_LONG_MSGID | MAPI_UNREAD_ONLY, &prgchMsgID ) ) )
Dort ist prgchMsgID so declariert:
STDMETHODIMP CApp::cReadMail ( ULONG ReadFlags, LPTSTR prgchMsgID )
Kann mir jemand bei der lösung helfen ?