1. <small id='YSyPU'></small><noframes id='YSyPU'>

  2. <i id='YSyPU'><tr id='YSyPU'><dt id='YSyPU'><q id='YSyPU'><span id='YSyPU'><b id='YSyPU'><form id='YSyPU'><ins id='YSyPU'></ins><ul id='YSyPU'></ul><sub id='YSyPU'></sub></form><legend id='YSyPU'></legend><bdo id='YSyPU'><pre id='YSyPU'><center id='YSyPU'></center></pre></bdo></b><th id='YSyPU'></th></span></q></dt></tr></i><div id='YSyPU'><tfoot id='YSyPU'></tfoot><dl id='YSyPU'><fieldset id='YSyPU'></fieldset></dl></div>
    <tfoot id='YSyPU'></tfoot>

      <bdo id='YSyPU'></bdo><ul id='YSyPU'></ul>
    1. <legend id='YSyPU'><style id='YSyPU'><dir id='YSyPU'><q id='YSyPU'></q></dir></style></legend>

      将 C++ 程序转换为 Windows 服务?

      时间:2023-08-01
      <i id='0iZzF'><tr id='0iZzF'><dt id='0iZzF'><q id='0iZzF'><span id='0iZzF'><b id='0iZzF'><form id='0iZzF'><ins id='0iZzF'></ins><ul id='0iZzF'></ul><sub id='0iZzF'></sub></form><legend id='0iZzF'></legend><bdo id='0iZzF'><pre id='0iZzF'><center id='0iZzF'></center></pre></bdo></b><th id='0iZzF'></th></span></q></dt></tr></i><div id='0iZzF'><tfoot id='0iZzF'></tfoot><dl id='0iZzF'><fieldset id='0iZzF'></fieldset></dl></div>

    2. <tfoot id='0iZzF'></tfoot>

        • <small id='0iZzF'></small><noframes id='0iZzF'>

          <legend id='0iZzF'><style id='0iZzF'><dir id='0iZzF'><q id='0iZzF'></q></dir></style></legend>
            <bdo id='0iZzF'></bdo><ul id='0iZzF'></ul>

              <tbody id='0iZzF'></tbody>

                本文介绍了将 C++ 程序转换为 Windows 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我写了一个控制台程序来做事"——主要是使用boost.如何将其转换为 Windows 服务?我应该事先了解有关 Windows 服务的哪些信息?

                I've written a console program that "does stuff" - mainly using boost. How do I convert it to a Windows Service? What should I know about Windows Services beforehand?

                推荐答案

                有一个关于如何在 MSDN 上设置最小服务的好例子.请参阅有关编写主函数、入口点和示例代码的部分.

                There's a good example on how to set up a minimal service on MSDN. See the parts about writing the main function, entry point and also the example code.

                一旦您构建并运行了 Windows 服务,您就会发现下一个主要问题:调试很痛苦.没有终端(因此没有 stdout/stderr),一旦您尝试运行可执行文件,它就会实际启动服务,然后返回给您.

                Once you've got a windows service built and running, you'll discover the next major gotcha: it's a pain to debug. There's no terminal (and hence no stdout/stderr) and as soon as you try to run the executable it actually launches the service then returns to you.

                我发现一个非常有用的技巧是向您的应用程序添加一个 -foreground 选项,这样如果您使用该标志运行,它就会绕过服务启动器代码,而是像常规控制台一样运行应用程序,这使得调试变得非常容易.在 VS.Net 中设置调试选项以使用该标志调用.

                One trick I've found very useful is to add a -foreground option to your app so that if you run with that flag then it bypasses the service starter code and instead runs like a regular console app, which makes it vastly easier to debug. In VS.Net set up the debugging options to invoke with that flag.

                这篇关于将 C++ 程序转换为 Windows 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Win32:如何通过 hWnd 在任务栏中隐藏 3rd 方窗口 下一篇:如何从 WinApi 中的 HANDLE 制作 FILE*?

                相关文章

                最新文章

              • <i id='i93n1'><tr id='i93n1'><dt id='i93n1'><q id='i93n1'><span id='i93n1'><b id='i93n1'><form id='i93n1'><ins id='i93n1'></ins><ul id='i93n1'></ul><sub id='i93n1'></sub></form><legend id='i93n1'></legend><bdo id='i93n1'><pre id='i93n1'><center id='i93n1'></center></pre></bdo></b><th id='i93n1'></th></span></q></dt></tr></i><div id='i93n1'><tfoot id='i93n1'></tfoot><dl id='i93n1'><fieldset id='i93n1'></fieldset></dl></div>

                  • <bdo id='i93n1'></bdo><ul id='i93n1'></ul>
                1. <small id='i93n1'></small><noframes id='i93n1'>

                2. <legend id='i93n1'><style id='i93n1'><dir id='i93n1'><q id='i93n1'></q></dir></style></legend>

                    <tfoot id='i93n1'></tfoot>