[译]服务向导
By robot-v1.0
本文链接 https://www.kyfws.com/applications/service-wizard-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 3 分钟阅读 - 1143 个词 阅读量 0[译]服务向导
原文地址:https://www.codeproject.com/Articles/3809/Service-wizard
原文作者:Dudi Avramov
译文由本站 robot-v1.0 翻译
前言
Service wizard integrated with the Visual Studio IDE.
与Visual Studio IDE集成的服务向导.
介绍(Introduction)
服务应用程序始终具有相同的框架.因此,最好将服务向导与Visual Studio IDE(集成开发环境)集成在一起.(Service applications always have the same skeleton. Therefore, it would be nice to have a service wizard integrated with the Visual Studio IDE (Integrated Development Environment).)
我的服务向导是由"自定义向导"项目类型创建的.其输出是AWX文件,应将其复制到(My service wizard was created by the “Custom Wizard” project type. Its output is an AWX file that should be copied to)<Visual Studio目录> \ Common \ MSDev98 \ Template(\Common\MSDev98\Template*)*夹.(*folder.*)
因此,在创建服务项目时,请从项目类型列表中选择"服务向导".(Therefore, when creating service projects, choose “Service Wizard” from the project type list.)
一步向导(One wizard step)
如上图所示,服务安装有3个参数:(As seen from the image above, there are 3 parameters for service installation:)
- 显示的服务名称-这是打开服务控制管理器时将显示的文本.(Displayed service name - This is the text that will be displayed when opening the service control manager.)
- 启动类型.(Startup type.)
- 服务应该与桌面交互吗?(Should the service interact with the desktop?)
安装和卸载服务(Install and uninstall your service)
该向导会写下用于安装和卸载服务的代码.使用'/Install’或'/Uninstall’参数运行可执行文件将分别安装或卸载该服务.(The wizard writes down code for installing and uninstalling your service. Running your executable with the ‘/Install’ or ‘/Uninstall’ parameter will install or uninstall the service, respectively.)
调试服务(Debugging your service)
由于创建的项目(通过向导)是控制台应用程序,因此您可以像调试控制台应用程序而不是服务一样调试服务.(Since the created project (by the wizard) is a console application, you can debug your service as if it were just a console application and not a service.)
去做 …(TO DO …)
您的应用程序代码应在方法中(Your application code should be in the method) Run()
位于(located in)service.cpp(service.cpp)文件.寻找评论(file. Look for the comment) // TO DO: Add code here
.这是服务运行的地方.(. This is the place where the service is running.)
更新(Updates)
-
2003年4月9日-发送(9.Apr.2003 - Send)
WM_QUIT
服务停止请求消息.(message on service stop request.) -
2004年1月18日-(18.Jan.2004 -)
- 当安装了服务并将其定义为具有自动启动功能时,将自动启动该服务.(Start the service automatically when the service is installed and defined to have automatic startup.)
- 卸载服务时,请等待该服务停止.(Wait for the service to be stopped when uninstalling the service.)
请享用…(Enjoy…)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 WinXP Windows Win2K MFC Visual-Studio Dev 新闻 翻译