Click here to Skip to main content
15,902,863 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPre-Compile Actions Pin
Yaron Nir19-Mar-03 21:20
Yaron Nir19-Mar-03 21:20 
GeneralRe: Pre-Compile Actions Pin
Pavel Klocek19-Mar-03 22:35
Pavel Klocek19-Mar-03 22:35 
GeneralRe: Pre-Compile Actions Pin
Yaron Nir19-Mar-03 22:38
Yaron Nir19-Mar-03 22:38 
GeneralRe: Pre-Compile Actions Pin
Pavel Klocek19-Mar-03 22:58
Pavel Klocek19-Mar-03 22:58 
GeneralRe: Pre-Compile Actions Pin
Hans Ruck19-Mar-03 23:59
Hans Ruck19-Mar-03 23:59 
Questionhow to build c++/MFC program for Data Encryption Standard(DES) Pin
pytongz19-Mar-03 20:57
pytongz19-Mar-03 20:57 
AnswerRe: how to build c++/MFC program for Data Encryption Standard(DES) Pin
r i s h a b h s20-Mar-03 20:00
r i s h a b h s20-Mar-03 20:00 
General.OutLook & Mapi problem Pin
chepuri_uk19-Mar-03 20:26
chepuri_uk19-Mar-03 20:26 
The following sample is MAPI from MSDN.
While runnin this is giving error:

Any help on this :

#include "mapix.h"
#include "mapiutil.h"
#include <mapispi.h>

HRESULT GetMAPIStatus(LPMAPISTATUS *pStatus, LPMAPISESSION pSession);

int main(int argc, char* argv[])
{
LPMAPISESSION pSession = NULL; //MAPI Session Pointer
LPMAPISTATUS pStat=NULL; //MAPI Status Pointer
LPMAPISUP pSupport=NULL;


HRESULT hRes = S_OK;

//Initialize MAPI.
hRes = MAPIInitialize(NULL);

//Log on to MAPI and get a session pointer.
hRes = MAPILogonEx(0, NULL, NULL, MAPI_LOGON_UI | MAPI_NEW_SESSION, &pSession);


if (hRes == S_OK && pSession) //if logon OK get a status pointer.
{


//Call function to get the status pointer.
hRes = GetMAPIStatus(&pStat, pSession);

if(hRes == S_OK && pStat) //if we successfully got a status pointer call FlushQueues on it.
{
//Flush inbound and outbound messages.
hRes = pStat->FlushQueues(NULL, 0, NULL, FLUSH_UPLOAD | FLUSH_DOWNLOAD);
if(hRes == S_OK)
MessageBox(NULL, "FlushQueues OK!", "FlushQueues", MB_OK);
else
MessageBox(NULL, "FlushQueues Failed!", "FlushQueues", MB_OK);
}
else
MessageBox(NULL, "GetMAPIStatus Failed!", "FlushQueues", MB_OK);

pSession->Logoff(NULL, 0L, 0);
}
else
{
MessageBox(NULL, "MAPI Logon Failed!", "FlushQueues", MB_OK);
}

//Clean up pointers.
UlRelease(pStat);
UlRelease(pSession);
MAPIUninitialize();

// MessageBox(NULL, "End of MAPI ", "FlushQueues", MB_OK);

return 0;
}

/////////////////////////////////////////////////////////////////
// Gets the spooler's status object from the session status table.
/////////////////////////////////////////////////////////////////
HRESULT GetMAPIStatus(LPMAPISTATUS *pStat, LPMAPISESSION pSession)
{
LPMAPITABLE pTbl = NULL;
LPSRowSet pRow = NULL;
HRESULT hRes;
SRestriction sres;
SPropValue spv;
ULONG ulObjType;
LPMESSAGE lpMsg = NULL;


const static SizedSPropTagArray(2,sptCols) = {2,PR_RESOURCE_TYPE,PR_ENTRYID};

if (FAILED(hRes = pSession -> GetStatusTable(0,&pTbl)))
{
MessageBox(NULL, "GetStatusTable Failed!", "GetStatusTable", MB_OK);
goto Quit;
}




sres.rt = RES_PROPERTY;
sres.res.resProperty.relop = RELOP_EQ;
sres.res.resProperty.ulPropTag = PR_RESOURCE_TYPE;
//sres.res.resProperty.ulPropTag = PR_STATUS;
sres.res.resProperty.lpProp = &spv;

spv.ulPropTag = PR_RESOURCE_TYPE;
spv.Value.l = MAPI_SPOOLER;

if(FAILED(hRes = pTbl->SetColumns((LPSPropTagArray) &sptCols,
TBL_ASYNC)))
{
MessageBox(NULL, "SetColumns Failed!", "GetStatusTable", MB_OK);
goto Quit;
}

if (FAILED(hRes = HrQueryAllRows(pTbl,
(LPSPropTagArray) &sptCols,
&sres,
NULL,
0,
&pRow)))
{
MessageBox(NULL, "HrQueryAllRows Failed!", "HrQueryAllRows", MB_OK);
goto Quit;
}

if (!pRow -> cRows || PR_ENTRYID != pRow -> aRow[0].lpProps[1].ulPropTag)
{

hRes = MAPI_E_NOT_FOUND;
MessageBox(NULL, "HrQueryAllRows Failed!", "HrQueryAllRows", MB_OK);
goto Quit;
}


/* hRes = pSession->OpenEntry(pRow -> aRow[0].lpProps[1].Value.bin.cb,
(LPENTRYID)pRow -> aRow[0].lpProps[1].Value.bin.lpb,
NULL,
MAPI_BEST_ACCESS,
&ulObjType,
(LPUNKNOWN*)&(*pStat));
*/





if (FAILED(hRes) || MAPI_STATUS != ulObjType)
{
hRes = hRes ? hRes : MAPI_E_INVALID_OBJECT;
MessageBox(NULL, "OpenEntry Failed!", "OpenEntry", MB_OK);
goto Quit;
}

Quit:
if (pTbl)
pTbl -> Release();

FreeProws(pRow);
return hRes;
}


Thank you
GeneralToolBar related problem. HELP Required. Pin
Farrukh4u19-Mar-03 20:14
Farrukh4u19-Mar-03 20:14 
QuestionAnybody can tell me Where can I download or install the latest version of Window Media Player Control (msdxm.ocx)? Pin
DengJW19-Mar-03 19:40
DengJW19-Mar-03 19:40 
AnswerRe: Anybody can tell me Where can I download or install the latest version of Window Media Player Control (msdxm.ocx)? Pin
Michael Dunn19-Mar-03 19:43
sitebuilderMichael Dunn19-Mar-03 19:43 
GeneralRe: Anybody can tell me Where can I download or install the latest version of Window Media Player Control (msdxm.ocx)? Pin
DengJW19-Mar-03 19:52
DengJW19-Mar-03 19:52 
GeneralRe: Anybody can tell me Where can I download or install the latest version of Window Media Player Control (msdxm.ocx)? Pin
benjymous20-Mar-03 0:29
benjymous20-Mar-03 0:29 
GeneralGetWindowsVersion().... Pin
JoeSox19-Mar-03 19:34
JoeSox19-Mar-03 19:34 
GeneralRe: GetWindowsVersion().... Pin
Michael Dunn19-Mar-03 19:41
sitebuilderMichael Dunn19-Mar-03 19:41 
GeneralRe: GetWindowsVersion().... Pin
JoeSox19-Mar-03 20:24
JoeSox19-Mar-03 20:24 
GeneralDLL question Pin
Michael Youhana19-Mar-03 18:50
sussMichael Youhana19-Mar-03 18:50 
GeneralRe: DLL question Pin
Vimal Earnest19-Mar-03 21:28
Vimal Earnest19-Mar-03 21:28 
GeneralRe: DLL question Pin
defrag0819-Mar-03 22:35
defrag0819-Mar-03 22:35 
GeneralRe: DLL question Pin
Vimal Earnest19-Mar-03 22:48
Vimal Earnest19-Mar-03 22:48 
General[how to] handling multiple menu item with single message handler Pin
zecodela19-Mar-03 15:53
zecodela19-Mar-03 15:53 
GeneralRe: [how to] handling multiple menu item with single message handler Pin
Hans Ruck19-Mar-03 21:21
Hans Ruck19-Mar-03 21:21 
Generalgroup radio button Pin
raner19-Mar-03 14:32
raner19-Mar-03 14:32 
GeneralRe: group radio button Pin
Michael Dunn19-Mar-03 15:44
sitebuilderMichael Dunn19-Mar-03 15:44 
GeneralRe: group radio button Pin
MemLeak20-Mar-03 4:36
MemLeak20-Mar-03 4:36 

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.