如何将Windows Applicatios转换为Windows服务 [英] How to Convert Windows Applicatios to Windows Service

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

问题描述

亲爱的朋友,

我在这里开发了一个Windows应用程序,即如果通过通知图标连接的调制解调器调制解调器连接成功消息将与Disconnected一样出现.我通过Program.cs文件盯着我的应用程序知道这种方法很好.但是我的问题是我想转换我的到Windows Service的应用程序,因为我不想用Exe文件启动我的应用程序.它应该仅通过Windows Service运行.所以我不知道如何操作和启动Windows应用程序到Windows Service.有关此的任何信息,请与我分享.



问候,

AnilKumar.D

Dear Friends,

Here i Developed one Windows Application that is if Modem Connected Through Notify Icon Modem Connected Sucessfuly Message will Come same like with Disconnected.I stared my Application through Program.cs file up to know this working fine.But my Problem is i want to convert my application to Windows Service because i dont want to start my application with Exe file.And it should run through Windows Service Only.So i dont know how to Manipulate and start my Windows application to windows Service.If any Information Regarding this please share with me.



Regards,

AnilKumar.D

推荐答案

从您的查询中我了解到您正在Windows应用程序中使用NotifyIcon,这在Windows服务中是不可能直接实现的……您需要Windows和系统托盘Windows应用程序,其中Windows服务将与系统托盘应用程序通信以显示通知图标.

您可以通过添加入口点将Windows应用程序转换为服务,并将主要逻辑移至onStart事件.

请参考此网址以获取更多信息. http://social.msdn.microsoft.com /Forums/zh-CN/clr/thread/d0fd133b-8954-42f2-ab46-f2d21c5d4550/ [ http://vbnotebookfor.net/2007 /08/14/how-to-convert-a-winforms-app-to-a-windows-service/ [ http://www.dreamincode.net/forums/topic/174424-how-do-you-convert-a-console-application-to-a-windows-service-in-c%23/ [ ^ ]
From your query I understood that you are using NotifyIcon in your windows application, this is not directly possible in windows service... you need to have windows and a system tray windows application, where the windows service will communicate to the system tray application to show the notify icon.

you can convert your windows application to service by adding an entry point and move your main logic to the onStart event.

please refer this urls for some more info. http://social.msdn.microsoft.com/Forums/en-US/clr/thread/d0fd133b-8954-42f2-ab46-f2d21c5d4550/[^]
http://vbnotebookfor.net/2007/08/14/how-to-convert-a-winforms-app-to-a-windows-service/[^]
http://www.dreamincode.net/forums/topic/174424-how-do-you-convert-a-console-application-to-a-windows-service-in-c%23/[^]


这篇关于如何将Windows Applicatios转换为Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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