Visual Studio 2010: Get COM error 0x80004001 when creating control drop down by CommandBarControls::Add() RRS feed

  • Question

  • I am still porting codes from VS2005 to VS2010. This time, a COM error  0x80004001 is watched when trying to add a control drop down to tool bar by CommandBarControl::Add(), the parameter given to this API is:


    _CommandBarComboBoxPtr commandBarControl; 
    commandbarControls->Add( CComVariant(msoControlDropdown), CComVariant(1), CComVariant(static_cast<LPCWSTR>(nullptr)), CComVariant(12), CComVariant( VARIANT_TRUE ), (CommandBarControl**)&commandBarControl


    After some searching effort, from the following URLs, I noticed that adding control combo box by DTE (CommandBarControl::Add) may not be supported in VS2010.



    I don't know if control drop down is not allowed in VS2010? Or I just call this API with bad input argument in VS2010?


    Monday, June 20, 2011 6:08 AM