PDA

View Full Version : Windows, application code


Spearball
12-06-2008, 08:55 PM
Hey all I'm getting into programming and before i dive deeper i would like to get an answer to a question. When an application, or even windows for this sake is waiting for you do do something like lets say a click of the mouse (windows) does it just loop a wait function until it detects an event has happened?

Thanks

Paul Komski
12-06-2008, 10:56 PM
Mouse click or move events as well as keyboard inputs are relatively straightforward because as long as the "form" is active at the time it can be made react to the event. Only one form (or window if you prefer) can be active at any moment in time. Some applications, typically services, dont use forms/windows at all and are running in the background and respond, say to the detection of viral or network activities. They would typically keep "looping" until a criteria was reached or sometimes can respond to other Windows events (say a file execute command somewhere else) which Windows sort of posts up on a "virtual bulletin board".

There are analagous other functions that are not dependent on "events" coming from an HID (Human Interface Device). So, for example, one might want some other event to be triggered or for code to run in a particular way after a certain period of time has elapsed or there might be a continuous check for some other criteria (in a looping fashion) before responding in any one of a number of ways.

Say, for example, you want an application to respond in a certain way to the arrival of an email (or something else outside one's control) then either it must keep checking for that criteria after set amounts of time or in a continuous loop. That loop could also, for example, keep incrementing a variable until it reaches a certain value (say the arrival of six emails) before doing something.

Hope this makes sense to you.

Spearball
12-08-2008, 02:30 AM
Thanks a lot, yea it made sense. :)