我们可以运行另一个win32 vc ++控制台应用程序作为服务 [英] can we run a another win32 vc++ console application as a service

查看:70
本文介绍了我们可以运行另一个win32 vc ++控制台应用程序作为服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个2 vc ++项目。一个被命名为样本,其中包含服务条目,服务主,服务控制处理程序和启动服务功能。 。另一个名为helloworld,在控制台应用程序中显示helloworld。两个项目都被选为win32控制台应用程序。



现在我的问题是,在sample.cpp中,createservice()包含'二进制文件路径名'字段。我给出了helloworld.cpp的路径名(执行路径名,即helloworld.exe)。当我在服务管理中启动示例服务时,我得到及时的错误。我不知道为什么会这样。我认为问题可能发生在路径名提供的位置。



我们也可以运行一个控制台应用程序作为服务。

请帮我解决。

I have a 2 vc++ project. one is named as sample which contains the service entry, service main, service control handler and start service function. . the other one is named as helloworld which displays the helloworld in console app. the both projects are chosen as win32 console application.

now my question is, in sample.cpp , createservice() contains 'binary file pathname' field. i gave the path name of the helloworld.cpp's (executed path name i.e. helloworld.exe). while i start the sample service in service snap in, i get the error of timely fashion. i dono why this happend. i think the problem may be happen in the point of pathname provided.

and also can we run a console application as a service one.
please help me to resolve it.

推荐答案

第一个问题没有意义,因为你没有正确描述你在做什么,也没有提供任何错误信息(或者是它是例外吗?)。



关于第二个问题:控制台应用程序不能作为Windows服务运行。要创建服务,请使用Visual Studio模板: http://www.jobsurprise.com/newrlc/register。 aspx [ ^ ]。



-SA
First question makes no sense because you did not describe properly what you are doing and did not provide any error information (or was it exception?).

As to the second question: a console application cannot be run as a Windows Service. To create a Service, use, for example, Visual Studio template: http://www.jobsurprise.com/newrlc/register.aspx[^].

—SA


这篇关于我们可以运行另一个win32 vc ++控制台应用程序作为服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆