- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个基于 ATL 7 的 CAtlServiceModuleT
类的 Windows 服务。此服务为系统上的各种应用程序使用的 COM 对象提供服务,如果在这些应用程序仍在运行时停止该服务,这些其他应用程序自然会开始出错。
我知道如果 CComModule 的 GetLockCount()
返回 0,ATL DLL 通过在 DllCanUnloadNow()
中返回 S_OK 来解决这个问题。也就是说,它会检查以确保没有人当前正在使用 DLL 提供的任何 COM 对象。我想要服务中的等效功能。
这是我在覆盖 CAtlServiceModuleT::OnStop()
时所做的:
void CMyServiceModule::OnStop()
{
if( GetLockCount() != 0 ) {
return;
}
BaseClass::OnStop();
}
现在,当用户尝试从“服务”面板停止服务时,他们会看到一条错误消息:
Windows could not stop the XYZ service on Local Computer.The service did not return an error. This could be an internal Windows error or an internal service error.If the problem persists, contact your system administrator.
停止请求确实被拒绝了,但它似乎使服务处于错误状态。第二个停止请求导致此错误消息:
Windows could not stop the XYZ service on Local Computer.
Error 1061: The service cannot accept control messages at this time.
有趣的是,这次服务确实停止了(尽管我不希望它停止,因为仍然有未完成的 COM 引用)。
我有两个问题:
最佳答案
你不能这样做。一旦 SCM 向您的服务发送 SERVICE_CONTROL_STOP,您就必须停止。
如果您的其他应用也是服务,您可以使它们成为 SCM 中的依赖项。当然,如果使用该服务的应用只是普通应用,则不能使用。
关于com - 我如何拒绝 ATL 7 中的 Windows "Service Stop"请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2601756/
我正在使用 embarcadero C++ XE8 32 位。当我包含以下文件时: #include #include #include #include 我收到以下错误: [bcc32 Fatal
我正在将 VS2008(VC++) 代码迁移到 VS2013。我收到以下错误: error C2664: 'HRESULT _CopyItfFromAdaptItf::copy(T **,ATL::C
我试图在 Visual Studio 2013 上运行这个程序,但是当我包含一个对象 - myparser.obj 时,我收到以下错误: 1>MyParser.obj : error LNK2001:
如何正确转换这种方式? VARIANT varIndex; CString csIndex; //Index BSTR csIndex = (LPCSTR)(_bstr
因此,我正在使用向导在 visual studio 2008 中创建一个 ATL 项目(此处推荐 - How to create ActiveX DLL in Visual C++ - 以及其他地方)
我有一个关于 ATL(C++) VS2010 的项目。我创建了一个对话框类。有两个按钮,想要添加文本框之类的东西。我读到负责此组件 CEdit。 CEdit* pEdit = (CEdit*)GetD
我使用 Visual Studio 2005 向导创建了一个 ATL COM Server C++ 项目。我使用 ATL 简单对象向导添加了一个新的 COM 类。现在,当我尝试从我的服务器(在 ATL
我们有一个已经存在很长时间(可能早在 Visual Studio 6)的 DLL 项目,它已针对 VS 的每个新版本进行了更新。该项目包含许多使用 ATL 实现的 COM 类。 升级到 VS 2010
我有一个使用 ATL 库的 C++ 项目。在 Visual Studio 2012 中,我曾经看到过以下两个文件: 程序文件 (x86)\Microsoft Visual Studio11.0\VC\
我以前从未使用过 COM,并且我的任务是编写一个使用某些第三方 COM 对象的应用程序。如果有人能给我一些关于如何使用它们的好教程,我将不胜感激。更直接的是,我似乎没有安装事件模板库。我在网上搜索过,
我必须创建 BYTE* 数组来为 Http 请求存储一些文本和二进制数据。像这样的东西: Content-Type: multipart/form-data; boundary=Asrf456BGe4
我不熟悉这个,可以使用kick start。 我正在使用 ATL(非托管 C++)用户控件并希望使用 ShockWave ActiveX 对象。我需要知道如何声明它,以便我可以设置属性或调用方法。 例
我使用 ATL 宏,如 A2T 和 A2CW。在开发计算机上一切正常。当我在另一台计算机上使用应用程序 (visual studio 2008 pro) 时 - ATL 宏转换的输出不可读。 我希望有
我正在尝试使用以下方式注册 atl 服务 ExeName.exe/服务 如此处所述:http://msdn.microsoft.com/en-us/library/74y2334x(VS.80).as
任何人都可以帮我找到一个最新的、工作的 ATL 项目,它有一个主窗口和一些组件吗?请看在上帝的份上,不要告诉我使用 WTL/Qt 或其他。我需要 ATL。没有关于它的最新项目。我只需要一个主窗口,仅此
我最近遇到了 atls.lib 的链接问题。我更新了链接器的附加依赖项行: comctl32.lib C:\WinDDK\7600.16385.1\lib\ATL\i386\atls.lib C:\W
ATL::CComModule::RegisterServer(TRUE) 调用究竟做了什么(它写入了哪些注册表项)? 最佳答案 对于每个使用 OBJECT_ENTRY_AUTO 的类宏,它将运行资源
我的硬盘中有 atls.lib,但无法将其链接到我的 Visual Studio 项目中。我知道 atls.lib 是 ATL 特定的库文件,并且我拥有所有 ATL 文件/ header /库。但是,
我正在为一个项目使用 ATL 和 WTL 的组合,并从 CWindowImpl 派生了我自己的类,它看起来像这样: class CMyControl : public CWindowImpl { pu
我正在尝试将XText与EMF的ATL模型结合起来进行模型转换。我正在读取我的 DSL,将其转储到 EMF 的 XMI 资源中,然后将其放入 ATL api 中:ATL 不会给我任何错误并且运行正确:
我是一名优秀的程序员,十分优秀!