first Automation
//创建一个容器
CEmbWordCntrItem * pItem = NULL;
CEmbWordDoc * pDoc = GetDocument();
pItem = new CEmbWordCntrItem(pDoc);
CLSID clsid = {0};
//创建Automation服务器
CLSIDFromProgID(L"Word.Document", &clsid);
pItem->CreateNewItem(clsid);
//显示
pItem->DoVerb(OLEIVERB_SHOW, this);
CRect rcClient;
GetClientRect(&rcClient);
pItem->SetItemRects(&rcClient);
m_pSelection = pItem;
菜单 View 添加Command OnText { //获取Word.Document的接口 _Document doc m_pSelection->GetDispatch(); _Application app = doc.GetApplication(); Selection sel = app.GetSelection(); //输入文字 sel.TypeText("Hello World");
IDispatch * CEmbWordCntrItem::GetDispatch() { IDispatch * piDispatch = NULL; m_lpObject->QueryInterface(IID_IDispatch, (LPVOID*)&piDispatch);
} 导入MSWORD.OLB 类型库
//客户端模式 //创建服务器 //显示 _Application app; app.CreateDispatch("Word.Application"); app.SetVisible("TRUE"); Documents docs = app.GetDocuments(); COleVariant varTemplate(_T""); COleVariant newTemplate(0L); COleVariant varDocumentType(0L); COleVariant varVisiable;
_Document doc = docs.Add(&varTemplate,
&newTemplate, &varDocumentType, &varVisiable); Section sel = app.GetSelection(); sel.TypeText("Hello"); doc.Save();
/////// Atuomation服务器 EXE
AfxGetMainWnd()->ShowWindow(); GetActiveView()->SetWindowText DLL
IAutoExe autoexe; autoexe.CreateDispatch("AutoExe.Document"); autoexe.SetVisible(TRUE); autoexe.DetachDispatch();
添加dll 添加类 CCmdTarget父类 注册 使用
first Automation的更多相关文章
- Workload Automation分析及其使用
Workload Automation介绍 Workload Automation是提供一个在设备上运行各种workload的工具,使用Python编写.WA具有良好的框架结构,方便快捷的扩展.包含几 ...
- SQL Server 阻止了对组件 'Ole Automation Procedures' 的 过程'sys.sp_OACreate' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configur
参见:http://msdn.microsoft.com/zh-cn/library/ms191188(SQL.105).aspx Ole Automation Procedures 选项 [本主题为 ...
- SharePoint 2013 中的 PowerPoint Automation Services
简介 许多大型和小型企业都将其 Microsoft SharePoint Server 库用作 Microsoft PowerPoint 演示文稿的存储库.所有这些企业在 ...
- Automation Test in Maya Plugin Development
现状和问题- 开发插件的功能A的时候随手建立场景, 测试插件的功能A. 测试通过后,测试场景就被丢掉.- 发现插件的功能A有bug时, 修改代码, 然后随手建立场景, 测试bug. 测试通过后,测试场 ...
- Study plan for automation test framework
虽然部门的automation建立起来有两年多,去年项目一直很忙,仅限于应用(e.g 运行脚本测试或者写一些简短的测试脚本),但是一直没有深入研究其组成框架.近期希望抽出时间来做深入学习. 初步计划从 ...
- 自动化测试 using System.Windows.Automation;
frameworke3.0 及以上 using System.Windows.Automation; UIAutomationClient.dll UIAutomationClientsideProv ...
- UI Automation Test
UI Automation test is based on the windows API. U can find the UI Automation MSDN file from http://m ...
- Azure Automation (1) 入门
<Windows Azure Platform 系列文章目录> 通过Azure Automation(自动化),开发人员可以自动完成通常要在云环境中执行的手动.长时间进行.易出错且重复性高 ...
- Azure Automation (2) 定期删除存储账号中的文件
<Windows Azure Platform 系列文章目录> 本文介绍的是国内由世纪互联运维的Azure China. 本文是对笔者之前的文档Azure Backup (1) 将SQL ...
随机推荐
- ubuntu14.04设置静态ip
1. 找到文件并作如下修改: sudo vim /etc/network/interfaces 修改如下部分: auto eth0 iface eth0 inet static address 192 ...
- TOJ 2776 CD Making
TOJ 2776题目链接http://acm.tju.edu.cn/toj/showp2776.html 这题其实就是考虑的周全性... 贡献了好几次WA, 后来想了半天才知道哪里有遗漏.最大的问题 ...
- javascript 组合
1. 大数组中有m个元素,抽取其中的n个进行组合. var combination = function(arr, num){ var r=[]; (function f(t,a,n) { ) { r ...
- Expression2Sql的一些语法更新
前言 前一阵子给大家介绍了一个可以将Expression表达式树解析成Transact-SQL的项目Expression2Sql. 之后得到了广大读者的一些好评,也使得博主更有动力继续更新下去,然后一 ...
- 修正iOS从照相机和相册中获取的图片方向(转)
- (UIImage *)fixOrientation { // No-op if the orientation is already correct if (self.imageOrientati ...
- Python3基础 casefold 将字符串中的所有字符变成小写
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- 测试oracle数据库的脱机备份和恢复
环境:windows7.Oracle11g 一.脱机备份 脱机备份是指在数据库关闭情况下的数据备份,也称为冷备份. 在书上学到的备份步骤: 1.记录所要备份数据库文件所在的操作系统路径: 2.关闭数据 ...
- Redis使用系列目录(一)
环境介绍 Redis 安装 Redis配置文件详解 Redis主从复制搭建 Redis集群环境搭建 Redis高可用
- HTML中使背景图片自适应浏览器大小
由于<body>标签的图片不能够拉伸, 解决办法: 1.图片不够大,又background属性不能拉伸图片: 2.只能用个div,把其z-index值设为负,并使这个div大小为整个bod ...
- div中的内容水平垂直居中
1. div高度自适应的情况 div在不设置高度的时候,会被里面的内容撑开,内容自动填充在div中,无论是一行内容还是多行内容,此时不需要设置垂直居中,内容自动在中间的, 想要看的更直观些,只需要加上 ...