问题描述
我有一个名为a.exe的窗口控制台程序,由VC ++运行,每天24小时运行。
我试图将此程序更改为Windows服务程序。
但是当我编写一个关于它的代码时,看到我的手册,编译器无法知道变量类型的SERVICE_TABLE_ENTRY,或SERVICE_STATUS等。
1.什么是我的主要错误点,即使它是在手册中写的?
2.作为满足此目的的另一种方法,我将使用开始按钮进行对话,所以如果点击它, ShellExecute()函数打开包含sc / create a.bat的批处理文件。但是这导致了一条关于拒绝访问的错误消息....
所以这两个错误对我来说都是非常复杂的问题,对于一个新手来说制作Windows服务并不容易。
请让我展示一下这个简单的样品。
提前谢谢。
我尝试了什么:
这个问题浪费了3天多。
I have a window console program named a.exe by VC++ which is running 24 hours a day.
I tried to change this program to windows service program.
But when I have written a code about it as seen my manual, the compiler could not know the variable type of SERVICE_TABLE_ENTRY, or SERVICE_STATUS, etc.
1. What is my main error point even though it is written as in the manual?
2. As another ways to satisfy this purpose, I will make a dialogue with a "Start" button, so if clicking it, the "ShellExecute()" function open the batch file which is including "sc /create a.bat". But this caused an error message about "access denied"....
So both errors are very complicated problems to me, making windows service for a novice is not easy.
Please let me show the simple samples about this.
Thank you in advance.
What I have tried:
More 3 days wasted for this problem.
推荐答案
这篇关于如何从窗口控制台程序创建Windows服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!