如何从Windows Service启动Win Forms应用程序? [英] How to launch win forms app from windows service ?

查看:187
本文介绍了如何从Windows Service启动Win Forms应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我想从Windows服务从FaxLibCom启动Send()方法.但这是行不通的(来自win窗体的相同代码效果很好).

所以我想,我可以运行win froms窗口,该窗口将被隐藏,并自动启动FaxLibCom发送传真.

但是Windows服务无法使用UI启动任何内容!我知道这是一个没有UI的长期运行的过程..但是必须有一种解决方案,才能从Windows服务运行另一个程序..我认为..

请帮助我,

Basically I want to launch Send() method from FaxLibCom, from windows service. But it is not working (The same code, from win forms works great).

So I thought, I could run win froms window, which will be hidden, and automatically launch FaxLibCom to send Fax.

But Windows Service can''t launch anything with UI !! I know that it is a long-running process without UI.. but there must be a solution to run another program from windows service.. i think..

Please help me,

推荐答案

Windows服务的目的之一是在没有UI的情况下运行,因此尝试使用UI当然没有任何意义.您可能需要进一步研究该库,以找到是否可以使用非UI调用,或者使用另一个库.
One of the purposes of a Windows Service is to run without a UI so it of course makes no sense to try using one. You may need to investigate the library further to find if a non-UI call is available, or use another library.


我记得不久前尝试做类似的事情,但事实证明,您可以从Windows服务调用winforms应用程序,但是它作为隐藏进程启动,并且GUI永远不会呈现(您可以在TaskManager中看到该进程).首先要有Windows服务的要点是,使它们可以单独运行到Windows窗体应用程序.但是,如果您确实可以使用,请分享...

也可以在这里阅读: Winforms-Windows服务 [ ^ ]

干杯...
I remember trying doing something similar not long ago, but it turned out that you can call a winforms app from a windows service but it starts as a hidden process and the GUI never gets rendered (you can see the process in TaskManager). The key point to have a windows service to begin with, is so that they can run separately to Windows forms app. However, if you do get it working, please share...

Also have a read here : Winforms-Windows service[^]

Cheers...


这篇关于如何从Windows Service启动Win Forms应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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