|
|
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
|
|
|
|
|
hi all,
i am making a tool bar for Internet Explorer.
I am using KBBar Sample that is provided in MSDN as well as on www.codeproject.com for downloading.
when the width of the Band containing the toolbar is made small, chevrons appear. When chevron is clicked buttons are displayed in a menu.
when these buttons(drop down buttons as well as normal push buttons) are clicked, Neither do they send any WM_COMMAND Message Nor do they send any TBN_DROPDOWN notification.
Where as in normal simple state (when band containing toolbar is of normal size), these notification and messages are observed sent and are handled easily.
i will be thankful , plz help me.
regards
Farrukh
|
|
|
|
|
My current version is 6.4.9.1125.
I want to build up a customized Media player based on this control.
THanks
JW
DJ
|
|
|
|
|
|
Thank you, Mike.
But what I want is just the Media Player Control (msdxm.ocx) file so that I can use this latest version in my VC++6 project?
Any more ideas?
DJ
|
|
|
|
|
But the control is part of media player - you won't be able to update one without the other (and installing the latest media player will update the control too)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Why am I thinking that I have seen this function(or named diffently of course) some where before but I can not find any info on how to logically get the user's current version of windows? What is the most logical way to get the user's current version of windows?
Thanks
Later, JoeSox www.joeswammi.com It's not easy facin' up when your whole world is black Rolling Stones
|
|
|
|
|
It's called GetVersionEx()
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
If privacy is outlawed, only outlaws will have privates.
|
|
|
|
|
Thank you thank you, I thought I was going crazy.
Oh wait, don't reply to that last comment;P
If I only had all of the MFC functions memorized then maybe I wouldn't be so dependant on MS search technology, rather lack of it
Later, JoeSox www.joeswammi.com It's not easy facin' up when your whole world is black Rolling Stones
|
|
|
|
|
According to MSDN:
Every process that loads the DLL maps it into its virtual address space. After the process loads the DLL into its virtual address, it can call the exported DLL functions.
Suppose a process starts and at some stage it dynamically loads a dll. A second process also load the same dll. Now what actually happened ??? Do each of these processes share the same chunk of memory where dll is loaded or dll code is loaded at two different locations for both of these processes ???
|
|
|
|
|
Yes, the two processes share the same chunk of memory.
~ Vimal
|
|
|
|
|
Vimal Earnest wrote:
Yes, the two processes share the same chunk of memory.
Suppose the function exposed by the dll has some static variable. Now what happens in this case...whether both applications that are using this dll share single copy of variable ???
|
|
|
|
|
What happens is, the COW (Copy On Write) mechanism is used by the system to make a private copy of these variables. To be specific, the system makes a private copy of the memory section containing static and global variables in the process modifying these variables.
refer chapter 19 (DLL basics) of Jeffrey Richter's Programming Applications for Microsoft Windows 4th ED for more info.
~ Vimal
|
|
|
|
|
dear all,
i have a menu for controlling from 0 - 100%, total 11 steps (11 items in menu)...
if i use individual message handler for each item, there are 11 functions... but, their difference is just the control value.
so, anyone have any idea to multiple handle menu items with single handler function?
thanks,
jim
|
|
|
|
|
Use ON_COMMAND_RANGE in the message map.
rechi
|
|
|
|
|
I've learnt earlier that we just have to check "Group" property of the first radio button to group the subsequent radio buttons under it. However after some time, i decided to add another 2 radio buttons on the dialog box. Visually, it's just below the previous radio buttons.However i don't know how to place them under the previous group of radion buttons....
can anyone help?
thanks
|
|
|
|
|
The radio buttons that are in a "group" need to be consecutive in the tab order. WHen you're in the dialog editor, press Ctrl-D to edit the tab order.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
If privacy is outlawed, only outlaws will have privates.
|
|
|
|
|
You can write into the *.rc file so that your radio control are consecutive.
to open it, just right click on it and select open with...
you choose Source Code (text) Editor
Everything's beautiful if you look at it long enough...
|
|
|
|
|
I’m trying to attach a Word doc to my application so I can modify it.
Here is my code so far:
IUnknown *p = NULL;
CLSID clsid;
IClassFactory *pClf = NULL;
CoInitialize(NULL);
CLSIDFromProgID(L"Word.Document.8", &clsid);
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, clsid, (void **)&p);
When I run the code, hr gets the following error: -2147467262
Any help would be greatly appreciated.
Thanks,
Ken
|
|
|
|
|
If you type hr,hr in the watch window, you can see what the error is, in text.
This might help
Also try to type @EAX,hr in the watch window, then you can always see the last returned HRESULT
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thanks for your response,
The error is "No such interface supported" and I don't know why?
Thanks again,
Ken
|
|
|
|
|
Because you are passing the CLSID again where you should be passing the IID of the interface you want - IID_IDispatch .
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
If privacy is outlawed, only outlaws will have privates.
|
|
|
|
|
Anders Molin wrote:
Also try to type @EAX,hr in the watch window, then you can always see the last returned HRESULT
Nice.!!
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|
Hello all,
I'm using a CListView class in report mode,in my splitter window.When I'm trying to insert items, I see that although I can add the first item data, I cannot see other items(i.e. I can see Hello and the World column, but no entry under it. Help??
//Precreate window -
//cs.style |= LVS_REPORT|LVS_SORTASCENDING; //set list styles
//then
InsertColumn(0,IDS_HELLO);
InsertColumn(1,IDS_WORLD);
CString szHello("Hello");
CString szWorld("World");
CListCtrl& list = GetListCtrl();
ZeroMemory((void*) &Item, sizeof(Item));
Item.mask = LVIF_TEXT;
Item.iItem = 0;
Item.iSubItem = 0;
Item.pszText = (LPTSTR)(LPCTSTR)szSubject;
list.InsertItem(&Item);
list.SetItemText(0,1,(LPTSTR)(LPCTSTR)szWorld);
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|