使用VC++ ATL实现Office的COM插件[5]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 useresu 的 blog

        if(failed(hr))

        return hr;

 

 

atlassert(spcmdbars);

 

    // now we add a new toolband to word

    // to which we'll add 2 buttons

    ccomvariant vname("wordaddin");

    ccomptr <office::commandbar> spnewcmdbar;

   

    // position it below all toolbands

    //msobarposition::msobartop = 1

    ccomvariant vpos(1);

 

    ccomvariant vtemp(variant_true); // menu is temporary       

    ccomvariant vempty(disp_e_paramnotfound, vt_error);           

    //add a new toolband through add method

    // vmenutemp holds an unspecified parameter

    //spnewcmdbar points to the newly created toolband

    spnewcmdbar = spcmdbars->add(vname, vpos, vempty, vtemp);

 

    //now get the toolband's commandbarcontrols

    ccomptr < office::commandbarcontrols> spbarcontrols;

    spbarcontrols = spnewcmdbar->getcontrols();

本文关键:使用VC++ ATL实现Office的COM插件
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top