保持程序运行 [英] keep program running

查看:40
本文介绍了保持程序运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个没有窗体的Windows应用程序 - 只有一个以

sub main开头并且有一个系统计时器的模块,在我想要的已用事件中

运行一些代码,我怎么能让这个程序不通过sub

主代码运行,然后关闭而不用触发计时器?


我可以把


Do while 3<> 2


循环


在子主码的末尾,这似乎有用,但必须有一个

更好的方法。

解决方案

您是否正在尝试运行某些流程,这将执行一系列步骤?

VJ


" William LaMartin" < LA ****** @ tampabay.rr.com>在消息中写道

新闻:e7 ************** @ tk2msftngp13.phx.gbl ...

如果我有一个Windows没有表单的应用程序 - 只有一个以子主程序启动并且有一个系统计时器的模块,在已经过去的事件中我想运行一些代码,如何防止这个程序运行通过子主码然后关闭,而不是解雇计时器?

我可以把

Do While 3<> 2

循环

在子主代码结束时似乎有效,但必须有更好的方法。



William,


正如您所说,它不需要任何代码。你可以改一下吗。


可能它是一个带有threading.thread.sleep的循环。


但是你的文字没有说明你的节目如何停止。


Cor


" William LaMartin" < LA ****** @ tampabay.rr.com> schreef在bericht

新闻:e7 ************** @ tk2msftngp13.phx.gbl ...

如果我有一个Windows没有表单的应用程序 - 只有一个以子主程序启动并且有一个系统计时器的模块,在已经过去的事件中我想运行一些代码,如何防止这个程序运行通过子主码然后关闭,而不是解雇计时器?

我可以把

Do While 3<> 2

循环

在子主代码结束时似乎有效,但必须有更好的方法。



像Windows服务一样?


" ...使您能够创建在

它自己的Windows会话,然后它可以在计算机启动时自动启动

,也可以手动暂停,停止甚至

重新启动

http://www.codeproject.com/ dotnet / si ... owsservice.asp

Troy


" William LaMartin" < LA ****** @ tampabay.rr.com>在消息中写道

新闻:e7 ************** @ tk2msftngp13.phx.gbl ...

如果我有一个Windows没有表单的应用程序 - 只有一个以子主程序启动并且有一个系统计时器的模块,在已经过去的事件中我想运行一些代码,如何防止这个程序运行通过子主码然后关闭,而不是解雇计时器?

我可以把

Do While 3<> 2

循环

在子主代码结束时似乎有效,但必须有更好的方法。



If I have a Windows application with no form--only a module that starts with
sub main and which has a system timer, in the elapsed event of which I want
to run some code, how can I keep this program from running through the sub
main code and then closing without ever firing the timer?

I can put

Do While 3 <> 2

Loop

at the end of the sub main code and that seems to work, but there must be a
better way.

解决方案

Are you trying to run some process, that will execute a serious of steps?

VJ

"William LaMartin" <la******@tampabay.rr.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...

If I have a Windows application with no form--only a module that starts
with sub main and which has a system timer, in the elapsed event of which
I want to run some code, how can I keep this program from running through
the sub main code and then closing without ever firing the timer?

I can put

Do While 3 <> 2

Loop

at the end of the sub main code and that seems to work, but there must be
a better way.



William,

As you tell it there is not any code needed. Can you rephrase.

Probably it is a loop with a threading.thread.sleep in it.

However there your text does not tell how your program stops.

Cor

"William LaMartin" <la******@tampabay.rr.com> schreef in bericht
news:e7**************@tk2msftngp13.phx.gbl...

If I have a Windows application with no form--only a module that starts
with sub main and which has a system timer, in the elapsed event of which
I want to run some code, how can I keep this program from running through
the sub main code and then closing without ever firing the timer?

I can put

Do While 3 <> 2

Loop

at the end of the sub main code and that seems to work, but there must be
a better way.



Like a windows service?

"...enable you to create long-running executable applications that run in
its own Windows session, which then has the ability to start automatically
when the computer boots and also can be manually paused, stopped or even
restarted"

http://www.codeproject.com/dotnet/si...owsservice.asp
Troy

"William LaMartin" <la******@tampabay.rr.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...

If I have a Windows application with no form--only a module that starts
with sub main and which has a system timer, in the elapsed event of which
I want to run some code, how can I keep this program from running through
the sub main code and then closing without ever firing the timer?

I can put

Do While 3 <> 2

Loop

at the end of the sub main code and that seems to work, but there must be
a better way.



这篇关于保持程序运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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