zoukankan      html  css  js  c++  java
  • VC调用word时,怎样才能隐藏word的某些菜单项

    1.第一种方法
    Word::_DocumentPtr pDoc   =   m_lpDispatch;
    if   (pDoc   )
    {
    Office::_CommandBarsPtr pbars=   pDoc   -> GetCommandBars   ();
    if   (NULL   ==   pbars)
    {
    lstrcpy(g_tszErrorMsg,_T( "获取excel的GetCommandBars接口失败! "));
    return   E_FAIL;
    }
    Office::CommandBarPtr pbar;
    _bstr_t   bstrCommandName   =   _T( "Standard ");
    pbars   -> GetItem   (bstrCommandName)-> PutVisible   (VARIANT_FALSE);
    bstrCommandName   =   _T( "Formatting ");
    pbars   -> GetItem   (bstrCommandName)-> PutVisible   (VARIANT_FALSE);
    2.第二种方法:
        HWND   hwnd   =     FindWindowEx(m_hWnd,NULL, "EXCEL2 ",NULL);
    HWND   hclosewnd   =   NULL;

    while   (hwnd   !=   NULL)
    {
    hclosewnd   =   FindWindowEx(hwnd,NULL, "MsoCommandBar ", "工作表菜单栏 ");
    if   (hclosewnd)
    SendMessage(hclosewnd,WM_CLOSE,0,0);
    hclosewnd   =   FindWindowEx(hwnd,NULL, "MsoCommandBar ", "图表菜单栏 ");
    if   (hclosewnd)
    SendMessage(hclosewnd,WM_CLOSE,0,0);
    hclosewnd   =   FindWindowEx(hwnd,NULL, "MsoCommandBar ", "格式 ");
    if   (hclosewnd)
    SendMessage(hclosewnd,WM_CLOSE,0,0);
    hclosewnd   =   FindWindowEx(hwnd,NULL, "MsoCommandBar ", "常用 ");
    if   (hclosewnd)
    SendMessage(hclosewnd,WM_CLOSE,0,0);
    hclosewnd   =   FindWindowEx(hwnd,NULL, "MsoCommandBar ", "图表 ");
    if   (hclosewnd)
    SendMessage(hclosewnd,WM_CLOSE,0,0);

    hwnd   =     FindWindowEx(m_hWnd,hwnd, "EXCEL2 ",NULL);
    }

  • 相关阅读:
    Bootstrap 网页1
    Bootstrap 网页实例
    Bootstrap 警告框
    Bootstrap 表格
    Bootstrap 小功能
    【BZOJ1706】[usaco2007 Nov]relays 奶牛接力跑 矩阵乘法
    【BZOJ3669】[Noi2014]魔法森林 LCT
    【BZOJ2049,2631,3282,1180】LCT模板四连A
    【BZOJ4071】[Apio2015]巴邻旁之桥 Treap
    【BZOJ1009】[HNOI2008]GT考试 next数组+矩阵乘法
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/2210461.html
Copyright © 2011-2022 走看看