在控制台中从Windows服务显示消息 [英] Show messages in console from windows service

查看:140
本文介绍了在控制台中从Windows服务显示消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我双击我的服务器exe它运行作为控制台应用程序,我可以看到控制台中的日志。
我使用在 http://代码给出的代码进行了Windows服务。 msdn.microsoft.com/windowsdesktop/CppWindowsService-cacf4948
使用此服务器在后台运行,但我看不到控制台。任何人都可以告诉我如何通过服务向控制台发送消息。

When i double click on my server exe it runs as a console application and i can see the logs in console. I have made a windows service using the code given at http://code.msdn.microsoft.com/windowsdesktop/CppWindowsService-cacf4948 Using this the server runs in background but i cant see the console. Can anyone tell me how can i send messages to the console from a service??

谢谢!

推荐答案

我将我的日志从我的服务打印到管道句柄,我只是写了一个简单的管道客户端读取文件并将其显示在控制台中。
如果任何人需要代码,然后在这里发布。

Got it! I print my logs from my service to a pipe handle and i just wrote a simple pipe client which reads the file and displays it in the console. If anyone needs the code then ill post it here

谢谢!

这篇关于在控制台中从Windows服务显示消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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