Visual Basic.NET
  Home arrow Visual Basic.NET arrow WMI Programming with Visual Basic.NET: Mor...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

WMI Programming with Visual Basic.NET: More About Trapping System Events
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2005-08-01

    Table of Contents:
  • WMI Programming with Visual Basic.NET: More About Trapping System Events
  • Creating a better application
  • Is there any other good example to work with?
  • What about __InstanceDeletionEvent?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    WMI Programming with Visual Basic.NET: More About Trapping System Events


    (Page 1 of 4 )

    In my previous article, part six of this series, we started trapping system events through WMI. In this article we continue to discuss the same topic, but go more in depth.

    You can download the zip of the entire Visual Studio.NET solution (developed for this article) here.


    The first part of my series gives you the details for creating a Visual Studio.NET solution for WMI from scratch. It will not be repeated anymore in any of the future articles in this series.

    Can we watch for events permanently?

    In my previous article (part six), I introduced the concept of events
    in WMI. I also discussed "Event Queries." Several new classes were also introduced. Finally we looked at a simple example of handling the events of WMI. Therefore, before reading this article, I strongly suggest that you read the previous article in this series. You will understand this article if and only if you have thoroughly grasped my previous article.

    If you understood my previous article, you will know that the example
    I discussed in that article works only for one single event. The
    program automatically stops listening (or watching) for successive events (after the first notification of the event). Can we listen (or watch) continuously (permanently) for the events being generated by system? Will we be able to catch the events forever? Is the implementation much more difficult than for the single event handler?

    Any one who understands the example in my previous article would certainly raise the above questions. And of course, it is also a FAQ. But the wonder is that, the implementation is very easy. The only issues are the need to have a permanent "subscriber" for the respective type of event, and the need to add an event handler on
    our own.

    This raises another question. When should it stop listening (or watching)? Of course, this is as important as the above questions.
    If we don’t stop "watching" for the events (or, in other words, unsubscribe), some of the system resources may be blocked unnecessarily. So, our new application should "start" (subscribe) listening (or watching) and should also be able to "stop" (unsubscribe) listening.

    To meet all the requirements mentioned above, I would develop another application which looks pretty similar to that of the previous article, but with some minor changes. So, let’s start with the application then.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek