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

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

本文简介:选择自 useresu 的 blog

    ccomqiptr < office::_commandbarbutton> spcmdbutton2(spnewbar2);

           

    atlassert(spcmdbutton);

    m_spbutton = spcmdbutton;

    atlassert(spcmdbutton2);

           

    // to set a bitmap to a button, load a 32x32 bitmap

    // and copy it to clipboard. call commandbarbutton's pasteface()

    // to copy the bitmap to the button face. to use

    // word's set of predefined bitmap, set button's faceid to     //the

    // button whose bitmap you want to use

    hbitmap hbmp =(hbitmap)::loadimage(_module.getresourceinstance(),

    makeintresource(idb_bitmap1),image_bitmap,0,0,lr_loadmap3dcolors);

 

    // put bitmap into clipboard

    ::openclipboard(null);

    ::emptyclipboard();

    ::setclipboarddata(cf_bitmap, (handle)hbmp);

    ::closeclipboard();

    ::deleteobject(hbmp);       

    // set style before setting bitmap

    spcmdbutton->putstyle(office::msobuttoniconandcaption);

           

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

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

go top