Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


February 12, 2004

How to Raise and Trap Events

Event-driven WSH scripts
RSS
View this exclusive article with VIP access -- click here to join |
See More VBScript Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

Before the advent of Windows, many programs strictly followed a procedural design. You ran the program, and it did its work while you waited. When the program was finished, the command prompt returned and you could run another program. With Windows, a new paradigm became dominant: event-driven programming. As you interact with an application, events occur. For example, in programming terms, clicking a command button on a form or Web page raises a button's Click event. The programmer then writes a section of code to react to this event. If no such code exists, Windows simply discards the event.

You can apply the same event concepts to scripts. In other words, you can create event-driven scripts. Before I describe how to create these types of scripts, you need to know how events work and the terms used to describe that process.

An event source signals the occurrence of an event. Broadcasting this signal is called raising the event. Any object can be an event source, which is often called an event firer or event sender. An event receiver responds to an event, a process that's referred to as trapping or sinking an event. Event receivers, which are often called event handlers or event sinks, are subprocedures. So, to sum up, when an event firer raises an event, the event handler traps the event and performs an action. . . .

Top Viewed ArticlesView all articles
CES 2009: Ballmer Announces Windows 7, Windows Live, Live Search Milestones

During his first-ever Consumer Electronics Show (CES) 2009 keynote address last night in Las Vegas, Microsoft CEO Steve Ballmer announced the pending public availability of a feature-complete Windows 7, the final version of Windows Live Essentials, and ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Where is Microsoft NetMeeting in Windows XP?

...


Related Events Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing