用VC编一个程序,怎样让我的程序连接上word??
如能提供一个示例的程序,100分相送..谢谢!
如能提供一个示例的程序,100分相送..谢谢!
解决方案 »
- SOCKET接收XML数据出现丢失,急
- vc使用WinIo:
- 扩大交际圈,想和常年研究GIMP\CIMAGE\Paint.net\FreeImage\Devil\ImageMagick等人士交个朋友。
- 为什么windows SDK/api小论坛在Delphi大论坛下面?
- 怎么使ActiveMovie控件只显示上面部分
- 哪位大侠能讲一下VS2003下编写ATL Project与VS6.0下的区别?100分!
- 请帮我看看为什么加解锁失败?
- 哪位高手回答一下如何用vc把access中ole字段的word文档导出
- 请问怎么在vc sdi应用中增加一个.h和.cpp文件啊!
- 不是vc的问题:怎样在dos环境下访问局域网中其他计算机的共享资源?
- 高手帮忙看看 这个连接错误哪里错了 ?
- 急问D3D中如何获得鼠标即时坐标??
How To Attach to a Running Instance of an Office Application
Automation servers register themselves in the Running Object Table (ROT) through the RegisterActiveObject() API. Automation clients can attach to a running instance with code such as the following: ::CoInitialize(NULL); // Translate server ProgID into a CLSID. ClsidFromProgID
// gets this information from the registry.
CLSID clsid;
CLSIDFromProgID(L"Excel.Application", &clsid); // Get an interface to the running instance, if any..
IUnknown *pUnk;
HRESULT hr = GetActiveObject(clsid, NULL, (IUnknown**)&pUnk);
ASSERT(!FAILED(hr)); // Get IDispatch interface for Automation...
IDispatch *pDisp;
hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pDisp);
ASSERT(!FAILED(hr)); // Release the no-longer-needed IUnknown...
pUnk->Release(); // ----------------------------------------------------
// Your automation code here-
// ---------------------------------------------------- ::CoUnintialize();