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);
    }

  • 相关阅读:
    Redis实现分布式锁
    Redis数据结构
    Mysql与redis缓存一致性
    mysql分库分表
    mysql主从同步
    mysql配置优化
    Netty 参数优化
    JAVA多线程之park & unpack
    网络时钟服务器(网络校时服务器)无法同步的排查方法
    GPS北斗共视授时中的多径效应分析
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/2210461.html
Copyright © 2011-2022 走看看