|
Member 2972992 wrote: CString propertyName = _T("Email
Marking"); outlookUser->InvokeHelper(0x66, DISPATCH_METHOD, VT_DISPATCH,
(void*)&userProp1, params, propertyName, 1); //falls here!
Using a CString object is probably what is causing you grief.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
No, I think - tatic BYTE params[] = VTS_BSTR VTS_I4 VTS_VARIANT VTS_VARIANT; is correct because I have seen this in http://repositorium.googlecode.com/svn/trunk/AbstractSpoon/OutlookImpExp/Source/msoutl.cpp
What should CString be?
|
|
|
|
|
Member 2972992 wrote: What should CString be?
Without actually trying it, I honestly do not know. I'd try VARIANT and BSTR to see what they produce.
Since InvokeHelper() throws an exception, why are you not catching it and examining the actual cause?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I would hazard a guess from the code that its the same issue you had before, regarding the passing of [in, optional] VARIANT parameters. Everytime you come across an [in, optional] VARIANT parameter, what you have to pass is the address of a VARAIANT that contains type VT_ERROR, and value DISP_E_PARAMNOTFOUND. In this case, from the static BYTE params[] declaration there are two "optional" parameters.
COleVariant varOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
LPDISPATCH userProp1;
static BYTE params[] = VTS_BSTR VTS_I4 VTS_VARIANT VTS_VARIANT;
CString propertyName = _T("Email Marking");
outlookUser->InvokeHelper(0x66, DISPATCH_METHOD, VT_DISPATCH, (void*)&userProp1, params, (LPCTSTR)propertyName, 1, &varOptional, &varOptional);
Notes:
I have not looked up what dispatch method 0x66 is so I am not 100% sure.
The presence of a VTS_VARIANT in the params array does not always mean optional, however an optional parameter is always a variant.
The VTS_BSTR in the params array of an InvokeHelper call is expected to be an LPCTSTR. to allow the CString to pass the correct value always type cast it to (LPCTSTR). The type casting is neccessary because InvokeHelper is declared as void AFX_CDECL InvokeHelper(DISPID dwDispID, WORD wFlags, VARTYPE vtRet, void* pvRet, const BYTE* pbParamInfo, ...); so the compiler doesnt know specifically what to pass. By type casting it you ensure the correct value is passed.
|
|
|
|
|
Hi
I have tried your suggestion and that did work! However, because one of parameters is a bool what is the correct syntax for passing a bool? Would it be COleVariantBool varOptionalBool (VT_TRUE, VT_ERROR); ?
Further, when the line for saving the properties is called InvokeHelper(0xf048, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
It gives an unhandled exception again. Looking at the MS Office VBA for this, properties don't save method, and it appears to me that when you add and set the properties this carries out the saving. Have I got this wrong? Is there something else I need to do?
Thanks
|
|
|
|
|
To pass a bool use one of these
COleVariant varTRUE((short)-1,VT_BOOL);
COleVariant varFALSE((short)0,VT_BOOL);
I am unsure why Save (0xf048) would cause an exception. What is the exception ?
I am also unsure why you dont use type-safe methods of invoking Outlook. Open the Class Wizard dialog "key combination Ctrl+W". Click "Add Class...". Click "From a type library...". Locate your MSOUTLxx.OLB, mine is in "C:\Program Files\Microsoft Office\Office12" click Open. Select the appropriate classes, or all of them, and click OK. This will add to your project header and implementation files that, in my humble opinion, will make your life easier.
|
|
|
|
|
I have learn C/C++ language already,and i want to read some famous books.
Is there any famous book to exsplain C/C++ programming?
Give me some advice.thanks~
|
|
|
|
|
|
I will go and have a look,thanks
|
|
|
|
|
Read several, they may have different approaches that will help you have a rounder understanding.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
The task manager shows the amount of physical memory:
Total
Cache
Available
Free
I would like to know how to get and/or calculate the amount of free memory, since this is not the same as reported by GlobalMemoryStatus(Ex).
Regards
|
|
|
|
|
See here. You'll need to change the values for object, instance, and counter.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
OK. Thanks. So far so good, but the function PdhAddCounter needs localized strings, thus in Germany you need german strings, in france you need french strings, etc. Damn, I'm not that language professional and the recently added function PdhAddEnglishCounter is not available on XP systems... ( I love those guys in Redmond...).
Is there a way to find out the localized corresponding language strings?
|
|
|
|
|
If you know the index equivalent of the string you are interested in, a call to PdhLookupPerfNameByIndex() would help. See here and here for more.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Thank you for this! AddEnglish..., what a joke!
Live's getting easier each day!
|
|
|
|
|
MSDN offers this[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks, but I already know about that:
...since this is not the same as reported by GlobalMemoryStatus(Ex).
|
|
|
|
|
I am trying to develop IE toolbar in MFC using COM. On win7, the required dll (i.e. SelectorObjectAPI.dll) is present in %program files%\Microsoft\Internet Explorer Developer Toolbar\. But I am it is not there in XP SP3. I reinstalled IE 8 and result was same. Both m/c has IE 08.
Please Help!!!
|
|
|
|
|
|
Thanx... That Really helped
--
CHEERS!!!
|
|
|
|
|
|
So if Developer Toolbar is not an option, what else can I do. I need to create a toolbar for IE in C++ (specifically MFC + COM)
I have come across some samples but those samples need their (ready made) helper code to be included.
It's is learning adventure for me, so I would like to do every thing myself... Looking for any tutorial.
Thanx in advance
|
|
|
|
|
I create an owner draw btn with the styles WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, and I try to use WM_DRAWITEM to deal with different button actions:
if lpDrawItemStruct->itemAction == ODA_DRAWENTIRE, I Draw a normal state button picture, when mouse clicks on the button, I draw a sink style picture. but the wm_drawitem message seems not responsible for mouse hover action. Someone could give a solution?
|
|
|
|
|
|
It's too much job. I am looking for Windows' direct support this feature.
|
|
|
|