473,786 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application Idle - Good or bad practice?

Udi
Hi All,
What do you know about the Application.Idl e event?
When is it a good practice to use it and when should I not use it?
I know it fires when the app message queue is empty, and that this
happens a lot.
But if I register many handlers on this event, what impact will it have
on my application?
Is it true to say that it doesn't impact my application performances
becuase the queue is empty anyhow?
Thanks!

Mar 10 '06 #1
4 5818

"Udi" <Ud**********@g mail.com> wrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
| Hi All,
| What do you know about the Application.Idl e event?
| When is it a good practice to use it and when should I not use it?
| I know it fires when the app message queue is empty, and that this
| happens a lot.
| But if I register many handlers on this event, what impact will it have
| on my application?
| Is it true to say that it doesn't impact my application performances
| becuase the queue is empty anyhow?
| Thanks!
|

It depends largely on what your handlers are doing, as long as they don't
block the message pump you are safe, but once you are start computational
intensive tasks you might disturb the message pump and this will have an
impact on the responsiveness of the main UI.
Willy.
Mar 10 '06 #2
Udi
Thanks Willy,
So just to understand, if I have lots of very short handlers I'm ok?
Do they have lower priority than the main UI messages?
(What happens if i have registered say 5 handlers on App.idle, 3 are
dealt, and than comes a message from the main UI? Will the remaining 2
handlers be executed first on the next idle? will they be ignored?)
- Or, once the app.idle is fired, it will execute all of it's handlers,
and only after executing all of them it returns the control back to the
main UI queue?

Mar 10 '06 #3
Udi wrote:
Thanks Willy,
So just to understand, if I have lots of very short handlers I'm ok?
Do they have lower priority than the main UI messages?
(What happens if i have registered say 5 handlers on App.idle, 3 are
dealt, and than comes a message from the main UI? Will the remaining 2
handlers be executed first on the next idle? will they be ignored?)
- Or, once the app.idle is fired, it will execute all of it's handlers,
and only after executing all of them it returns the control back to the
main UI queue?


The latter is my understanding of how it works. Once it fires, it will
execute all handlers before returning. Note also that this fires just
before the thread becomes idle.
--
Tom Porterfield

Mar 11 '06 #4

"Udi" <Ud**********@g mail.com> wrote in message
news:11******** *************@e 56g2000cwe.goog legroups.com...
| Thanks Willy,
| So just to understand, if I have lots of very short handlers I'm ok?
| Do they have lower priority than the main UI messages?
| (What happens if i have registered say 5 handlers on App.idle, 3 are
| dealt, and than comes a message from the main UI? Will the remaining 2
| handlers be executed first on the next idle? will they be ignored?)
| - Or, once the app.idle is fired, it will execute all of it's handlers,
| and only after executing all of them it returns the control back to the
| main UI queue?
|

The handler runs on the UI thread, that means that it runs at the same
priority and as long as your handler runs, it blocks the processing of new
messages. Note that it's possible to interrupt the handler by pumping the
queue (DoEvents or similar) so that you don't block the message queue while
running time consuming handlers (reminds me of 16 bit Windows, shiver...).

All handlers will get executed supposed no new messages are waiting in the
system queue.
When an handler returns, the framework code pumps the queue and when a new
message arrived, it will handle that message (subject of message priorities
AFAIK) before invoking the next handler.

Willy.
Mar 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
46685
by: Frank Rizzo | last post by:
I want to log the user out when there has been a period of inactivity in the application. The key here is inactivity of the application, not the system. I know that you can retrieve the inactivity of the system via GetLastInputInfo. That's not what I want - I want inactivity of the application. Thanks.
3
2039
by: Jeff Greenland | last post by:
Hello everyone, I am having problems with Timers in a web application. They just seem to stop running after 15 minutes or so. My web application is set up like this: When a user hits a page in the site, that page (.aspx) instantiates a compiled class (.DLL). The instantiation process creates a Timer that runs in the background to perform tasks every so often (such as notifying clients
11
2004
by: Jochen Neyens | last post by:
We're in the process of developing an e-commerce application that vets can use to order medicines. One of the requirements is that the web application can communicate with a locally installed practice management application that uses MS-Access as a backend database. This way shipped e-commerce orders can we imported in the practice management application to update the stock levels of medicines. The web-application will be written in...
1
2159
by: Gordon Smith | last post by:
I'm just getting up to speed on Application Pools in IIS6 and I'm wondering if there would be any good reason to stick with the default value of for the Idle Timeout value for Worker processes (found in IIS Manager, Worker Pool Properties | Performance tab). I'm thinking about setting it to something much higher - like close to 24 hours - so that the Web sites on my server don't incur the delay when first requested after an idle timeout...
20
4498
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have found FileSystemWatcher class not very reliable and sometimes it behavies unexpectedly.I'm afriad that...
2
1657
by: henk | last post by:
I have a hard time to get the idle time only from my application. (a relogin box should appear after eg 1 min, when a user switch to word and start typing for 10min, the re-login should not appear. It should appear if my vb appication is active and there was no userinput for about 1 min. Found a example at http://www.vbmysql.com/samplecode/idle-time.html wich works fine, but it's "system wide". I tried something with me.windowstate but...
1
5303
by: Rob | last post by:
How can I write the following code in VB.NET : private void Form1_Load(object sender, System.EventArgs e) { // Submit to Idle event to set controls state at idle time Application.Idle += new EventHandler(Application_Idle); } private void Application_Idle(object sender, EventArgs e) {
5
2971
by: toddles666 | last post by:
Hi- Is there any way of restricting access to a database by application & account? For example, I only want the application APP1 to access the database using the USER1 account. I've tried to use the DB2 Governor to do this, but it seems it always allows the the first query to be processed before forcing the connection. Here is my db2gov config file: --- start config
1
5748
by: Visu | last post by:
Hi All! How to find the application idle time in VB.NET windows application? We can get the windows Idle time Private Declare Function GetLastInputInfo Lib "user32.dll" But i want the idle time of my application alone in VB.NET.
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.