Click here to Skip to main content
15,887,436 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to debug thread in other process? CreateRemoteThread Pin
code_discuss4-Nov-07 23:02
code_discuss4-Nov-07 23:02 
QuestionAccess DLL from "Common files" in multilingual environment Pin
FredeCH4-Nov-07 22:12
FredeCH4-Nov-07 22:12 
AnswerRe: Access DLL from "Common files" in multilingual environment Pin
Nelek4-Nov-07 23:54
protectorNelek4-Nov-07 23:54 
GeneralRe: Access DLL from "Common files" in multilingual environment Pin
FredeCH5-Nov-07 1:42
FredeCH5-Nov-07 1:42 
GeneralOfftopic Pin
Nelek5-Nov-07 2:14
protectorNelek5-Nov-07 2:14 
GeneralRe: Offtopic Pin
FredeCH5-Nov-07 20:23
FredeCH5-Nov-07 20:23 
GeneralRe: Offtopic Pin
Nelek5-Nov-07 20:52
protectorNelek5-Nov-07 20:52 
QuestionE_ACCESSDENIED issue Pin
monsieur_jj4-Nov-07 19:54
monsieur_jj4-Nov-07 19:54 
Hi all,



I am having and E_ACCESSDENIED HRESULT at my code at OpenAttach when I try to open an attachment here it is


HRESULT hResult;

enum {CLASS,MSG_PROPS }; 

SPropValue lpPropValueArray[MSG_PROPS];

lpPropValueArray[CLASS].ulPropTag = PR_MESSAGE_CLASS;

lpPropValueArray[CLASS].Value.lpszA = "IPM.Note";

IMAPITable *m_pAtTable = NULL;

hResult = m_Message->Interface()->GetAttachmentTable(0, &m_pAtTable);

if (hResult !=S_OK)

throw(HResultException("GetAttachmentTable failed in redmap::loopMSg", hResult));

std:tring sName = _T("");

LPSPropValue pProps = NULL;

ULONG cVals = 0;

LPATTACH lpAttach = NULL;

LPSRowSet attachRows;

ULONG ulNumChars = 0;

ULONG lCount = 0;

SPropValue *vals;

LPATTACH attach;


std:tring strAttachmentFilename = _T("");


SizedSPropTagArray(1,g_sptMsgProps) = {1,PR_HASATTACH};

if (SUCCEEDED(hResult = m_Message->Interface()->GetProps((LPSPropTagArray) &g_sptMsgProps, 0, &cVals, &pProps))) 

{ 

if (PR_HASATTACH == pProps[0].ulPropTag && pProps[0].Value.b)

{ 

static SizedSPropTagArray(6,sptCols) = {6,PR_ATTACH_LONG_FILENAME_W,

PR_ATTACH_NUM,

PR_DISPLAY_NAME,

PR_ATTACH_FILENAME_W,

PR_ATTACH_METHOD,

PR_ATTACH_DATA_OBJ};

if (SUCCEEDED(hResult = m_pAtTable->SetColumns((LPSPropTagArray)&sptCols, 0)))

{

if (SUCCEEDED(hResult = HrQueryAllRows(m_pAtTable,

(LPSPropTagArray) &sptCols,

NULL,

NULL,

0,

&attachRows)))

{

for (unsigned int ctr=0; ctr < attachRows->cRows; ctr++)

{

if(SUCCEEDED (hResult = m_Message->Interface()->OpenAttach(attachRows->aRow[ctr].lpProps[1].Value.l, NULL, MAPI_BEST_ACCESS, &attach)))

{ 

if(SUCCEEDED (hResult = attach->GetProps((LPSPropTagArray)&sptCols, 0, &lCount, &vals)))

{

if (vals[4].Value.l == ATTACH_EMBEDDED_MSG)

{

LPMESSAGE pMessageEmbAttach; 

hResult = attach->OpenProperty(

PR_ATTACH_DATA_OBJ, 

&IID_IMessage,

0,

MAPI_MODIFY,

(LPUNKNOWN *)&pMessageEmbAttach);

ULONG lCountSub = 0;

static SizedSPropTagArray(1,sptSubject) = {1,PR_SUBJECT}; 

SPropValue *valsSub; 

if (SUCCEEDED (hResult = pMessageEmbAttach->GetProps((LPSPropTagArray)&sptSubject, 0, &lCountSub, &valsSub))) 

{ 

sName = valsSub[0].Value.lpszA;

//loopMsg(pMessageEmbAttach,pStorage);

hResult = pMessageEmbAttach->SaveChanges(KEEP_OPEN_READWRITE); 

if (hResult !=S_OK){

throw(HResultException("pMessageEmbAttach->SaveChanges failed in redmap::loopMsg", hResult)); 

}

hResult = attach->SaveChanges(KEEP_OPEN_READWRITE); 

if (hResult !=S_OK){

throw(HResultException("attach->SaveChanges failed in redmap::loopMsg", hResult)); 

}


} //end if of msg subject 

if (valsSub)

MAPIFreeBuffer((LPVOID) valsSub);

if (pMessageEmbAttach)

pMessageEmbAttach->Release();

}//end if attch_embd

else

{

}

}//succeeded attach getprops

}//succeed openAttch

}


}//queryRows

MAPIFreeBuffer( attachRows );

}//setcolumns

}//PR_HASATTACH 

}//pIMsg->GetProps

if (pProps)

MAPIFreeBuffer((LPVOID) pProps);




What do i need to change in this code to make it work? Is this possible? after that will there be further errors to my code? (I have not tested it because I can't get pass the OpenAttach



Thanks,

Jj
AnswerRe: E_ACCESSDENIED issue Pin
monsieur_jj4-Nov-07 21:07
monsieur_jj4-Nov-07 21:07 
QuestionSearch Page Pin
UpdateMe4-Nov-07 19:33
UpdateMe4-Nov-07 19:33 
AnswerRe: Search Page Pin
Neo Andreson4-Nov-07 19:36
Neo Andreson4-Nov-07 19:36 
GeneralRe: Search Page Pin
UpdateMe7-Nov-07 21:41
UpdateMe7-Nov-07 21:41 
QuestionRe: Search Page Pin
Hamid_RT4-Nov-07 20:33
Hamid_RT4-Nov-07 20:33 
Questioni have problem with CString please help me Pin
rajneshmalik4-Nov-07 19:32
rajneshmalik4-Nov-07 19:32 
AnswerRe: i have problem with CString please help me Pin
Neo Andreson4-Nov-07 19:37
Neo Andreson4-Nov-07 19:37 
GeneralRe: i have problem with CString please help me Pin
Neo Andreson4-Nov-07 21:22
Neo Andreson4-Nov-07 21:22 
GeneralRe: i have problem with CString please help me Pin
KarstenK4-Nov-07 23:48
mveKarstenK4-Nov-07 23:48 
AnswerRe: i have problem with CString please help me Pin
Paresh Chitte4-Nov-07 19:48
Paresh Chitte4-Nov-07 19:48 
AnswerRe: i have problem with CString please help me Pin
Nishad S4-Nov-07 20:02
Nishad S4-Nov-07 20:02 
GeneralRe: i have problem with CString please help me Pin
rajneshmalik5-Nov-07 20:35
rajneshmalik5-Nov-07 20:35 
GeneralRe: i have problem with CString please help me Pin
Nishad S6-Nov-07 17:08
Nishad S6-Nov-07 17:08 
AnswerRe: i have problem with CString please help me Pin
ThatsAlok5-Nov-07 0:55
ThatsAlok5-Nov-07 0:55 
AnswerRe: i have problem with CString please help me Pin
Mark Salsbery5-Nov-07 5:40
Mark Salsbery5-Nov-07 5:40 
GeneralRe: i have problem with CString please help me Pin
rajneshmalik5-Nov-07 20:35
rajneshmalik5-Nov-07 20:35 
GeneralRe: i have problem with CString please help me Pin
Mark Salsbery6-Nov-07 4:39
Mark Salsbery6-Nov-07 4:39 

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.