PC Review


Reply
Thread Tools Rate Thread

Compiler Error: Does not like Outlook.CommandBarControls.CommandBarControlPtr.Add

 
 
Shawn
Guest
Posts: n/a
 
      21st Apr 2010
I have a sample program below that I'm trying to convert to the newer mso.tlh (the code has not been updated for years). So, I had to add all of the "Outlook::" and "Office::" since the old tlh did not have the namespace defined in the tlh file.

Down on the bottom of this code that I have extracted, I keep getting the compiler error that it does not how I'm trying to use "Add". I have tried various parameters with no success. What is wrong with it before I burn my hair off my head. :/


Outlook::_Explorer *pExp;
Office::_CommandBars *pCBs;
Office::_CommandBarButton *pBtn;
Office::CommandBar *pOurBar;
Office::CommandBarControls *pApplicationCommandBar;
long buttonpos;
HRESULT hResult;
string toolbar_name;

buttonpos = 1;

toolbar_name = "Application";

if (m_pOutlookApp == NULL) {
return S_FALSE;
}

try {
hResult = m_pOutlookApp->ActiveExplorer(&pExp);
} catch (_com_error) {
debugoutput("[%s:%d] Exception when trying to get active explorer\n", __FILE__, __LINE__);
}

if (pExp == NULL) {
debugoutput("[%s:%d] Could not get a active explorer\n", __FILE__, __LINE__);
return S_FALSE;
}

try {
hResult = pExp->get_CommandBars(&pCBs);
} catch (_com_error) {
debugoutput("[%s:%d] Exception when trying to get pointer to command bar\n", __FILE__, __LINE__);
}

if (pCBs == NULL) {
debugoutput("[%s:%d] Cannot load command bar.\n", __FILE__, __LINE__);
return S_FALSE;
}

try {
pOurBar = pCBs->GetItem(toolbar_name.c_str());
pOurBar->Delete();
} catch (_com_error) {
}

m_pApplicationCmdBar = pCBs->Add( toolbar_name.c_str(),
_variant_t((long)Office::msoBarTop),
vtMissing,
_variant_t(VARIANT_TRUE, VT_BOOL));
m_pApplicationCmdBar->Protection = Office::msoBarNoCustomize;

pApplicationCommandBar = m_pApplicationCmdBar->Controls;

// Add a button

Compiler barfs on the following "Add"...
pBtn = pApplicationCommandBar->Add( _variant_t((long) Office::msoControlButton),
vtMissing,
vtMissing,
_variant_t(buttonpos++),
_variant_t(VARIANT_TRUE, VT_BOOL));

Complier error below is generated for the "Add" above... why?!
error C2679: binary '=' : no operator defined which takes a right-hand operand of type
'class _com_ptr_t
<
class _com_IIID
<
struct Office::CommandBarControl,&struct __s_GUID _GUID_000c0308_0000_0000_c000_000000000046
>
>'

(or there is no acceptable conversion)
 
Reply With Quote
 
 
 
 
Shawn
Guest
Posts: n/a
 
      21st Apr 2010
Nobody has a clue to help me out? Am I'm leaving something out to help me? Do I have a bad tlh/tli files? Where can I get the latest tlh/tli files to make sure that I have the correct version?.
Submitted using http://www.outlookforums.com
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
run-time error commandbarcontrols JennM Microsoft Excel Misc 0 19th Dec 2008 05:43 PM
Possible VS2003 c# compiler bug: error CS0584: Internal Compiler Error: stage 'COMPILE' symbol '' eblanco Microsoft Dot NET Framework 0 28th Jul 2006 09:40 PM
Compiler Error Message: The compiler failed with error code -1073741819 Ram Microsoft ASP .NET 0 13th Sep 2005 10:52 AM
fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'f:\vs70builds\3077\vc\Compiler\Utc\src\P2\main.c', line 148) PufferFish Microsoft VC .NET 10 6th Aug 2004 10:33 PM
fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701) =?Utf-8?B?TWFyY28gTm92YQ==?= Microsoft VC .NET 9 27th Apr 2004 06:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:00 PM.