创建WORD.DOCUMENT组件的时候,用CLSCTX_INPROC_HANDLER、CLSCTX_LOCAL_SERVER有什么区别 (VC/MFC ATL/ActiveX/COM )
CLSCTX_INPROC_HANDLER,方式创建的时候,怎么获取MSWORD中的Applicaiton,Document接口。我试了几次好像都不行。
用CLSCTX_LOCAL_SERVER方式创建COM的时候,可以轻松的获取上面提到的接口,单无法做内嵌到其他窗口的功能。
Word是进程外组件,无法使用CLSCTX_INPROC_HANDLER来创建。你可以集成Active Document来嵌入Word这样的Active Document Server。
You're doing some things te hard way. Since you've used #import,
there were several helpful things generated for you that you aren't
using. Most notably is all the smart pointers derived from _com_ptr_t!
You also need to learn how to work with VARIANTs. The _variant_t class
makes it easy.
try
{
Word::_ApplicationPtr pWordApp ;
HRESULT hr = pWordApp.CreateInstance(
__uuidof( Word::Application ) ) ;
if ( hr == S_OK )
{
Word::DocumentsPtr pDocs = theApp.m_pWordApp->Documents ;
_variant_t vtFilename( _T("C:\\MyFile.doc") ) ;
Word::_DocumentPtr pDoc = pDocs->Open( &vtFilename ) ;
// etc.
}
}
catch ( _com_error & ce )
{
CString strMsg ;
strMsg.Format( _T("%s\n%S"), ce.ErrorMessage(),
(LPCWSTR)ce.Description() ) ;
AfxMessageBox( strMsg, MB_OK | MB_ICONSTOP ) ;
}
To my knowledge, Microsoft assumes that anyone smart enough to choose C++ is smart enough not to need documentation. :) They provide all documentation for the Office Automation interface directed to VB users.
If you've got the October 2001 MSDN Library, and are using Word 2000,
like me, the path for the documentation is as follows:
Office Developer Documentation
- Office 2000 Documentation
- Microsoft Office 2000 Language Reference
- Microsoft Word 2000 Reference
- Microsoft Word Visual Basic Reference
For other versions of MSDN or Word, this may obviously vary.
It's actually not too hard to translate. Look at the VB help, then look
at the corresponding object interface in your TLH file. You should see
the analogies.
怎样用VB连接局域网中电脑上的数据库(access,sql,dbf) (VB 数据库(包含打印,安装,报表) )
你应该使用C/S架构的数据库服务器,例如SQL Server, Oracle或者DB2。基于文件的数据库访问很容易造成数据库损坏。参考http://support.microsoft.com/kb/300216/
VC++.net中如何使用正则表达式?(.NET技术 VC.NET )
.Net类库里面System.Text.RegularExpression的用法和其他语言大同小异
VBS引擎那个导入就可以用,不管是VC6还是VC7用法都是一样的。但是要注意一下版本问题,导入随IE3发布的RegExp 1.0组件的类型库兼容性最好,但是默认导入的是最新版本的类型库。导入非默认类型库的方法可以参考http://msdn.microsoft.com/library/en-us/vclang/html/_predir_The_.23.import_Directive.asp,版本区别可以参考http://msdn.microsoft.com/library/en-us/script56/html/vtoriVersionInformation.asp
一些其他的类库也支持正则表达式,例如
http://www.boost.org 或者 http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm
最新的Platform SDK for Windows Server 2003 SP1 如何支持VC6.0?(VC/MFC 界面)
好不容易把Platform SDK for Windows Server 2003 SP1下载并安装好了,却发现文档里面写这个版本的SDK不支持VC 6.0,如果使用这个库在VC6.0里面编译的话将会导致连接错误。
请问大家,有没有办法能够使这个版本的SDK能够在VC6.0里面用使用
可以,安装Visual C++ Toolkit 2003就可以升级编译器。
但是,Visual C++ Toolkit 2003编译出来的目标文件和VC6的其他模块不兼容,比如调试器。推荐的方法还是使用免费的VC 2005 Express。
安装VC时出现的问题(VC/MFC 非技术类 )
在复制完所有文件后.
弹出一对话框,对话框内容为:
Setup was unable to create a DCOM user account in
order to register C:\program files\visual studio\Common\tools\Vs-Ent98\vanalyzr
\valec.exe 按确定按钮后,显示安装不完全成功
BUG: "Setup Was Unable to Create a DCOM User Account" Error Message in Visual Studio 6.0
http://support.microsoft.com/?scid=kb;en-us;257413&spid=3042&sid=10
关于 Extension Dll (VC/MFC 进程/线程/DLL)
在一个扩展Dll中导出一个CWnd的派生类JScollWnd,我还能不能在另一个扩展Dll中从JScollWnd派生出(不是导出)类CSGrid?如果能,那么JScollWnd前面的AFX_EXT_CLASS在第二个扩展Dll中将被解释成什么呢?如果不能,还有其他的办法吗?
http://msdn.microsoft.com/library/en-us/vccore/html/_core_mutual_imports.asp
在发布用VC++.net 2003开发的用于Web页面的OCX控件时如何去掉对.net环境的依赖(.NET技术 VC.NET)
现在依赖于msvcr71.dll,但很客户端都没有这个文件,OCX控件自动下载后,无法自动注册
msvcr71.dll不是.Net的一部分。再发布的步骤可以参考http://support.microsoft.com/default.aspx?scid=kb;en-us;326922、http://msdn.microsoft.com/workshop/delivery/download/overview/inf.asp
参见
Redistributing MFC, ATL, and OLE DB Templates Applications
Redistributing Microsoft Visual C++ 6.0 Applications
http://www.msdn.microsoft.com/library/en-us/dnvc60/html/redistribvc6.asp