WMI in .Net

It’s quite easy to work with WMI in .net. Follow these steps to get details of Win32_VideoController. Namespace to use is System.Management. 1. Create a management class object. [sourcecode language=’cpp’]Dim MngClass As New ManagementClass(“Win32_VideoController”)[/sourcecode] 2. Create a management object class collection instance and fill out this collection likewise… [sourcecode language=’vb’]Dim MngObjCollection As ManagementObjectCollection = MngClass.GetInstances […]
Continue reading…

 

netstat in .net

netstat is a cool tool to view all active tcpip/udp connections in our computer along with the names of applications who have opened these ports/connections. So as a demo open up command prompt and type netstat /a netstat /b -> displays exes which are using a particular port/connection netstat /? -> displays helps for this […]
Continue reading…

 

StringBuilder

One of the classes in .Net that I like is the StringBuilder class. So what is it? It’s like the StringBuffer class in java. It’s a mutable string class which does faster operation while concatenation and other string related functions because internally it doesn’t recreate String objects but maintains a big enough buffer to prevent […]
Continue reading…

 

Type of disk drive?

Any idea on how to know the type of a drive, i.e. whether it’s a removable drive or CD-ROM or a network drive and others. Yes! use GetDriveType( lpctszDrive ) which returns DRIVE_XXXX (drive type). So I will write some functions just to demonstrate these features. [sourcecode language=’cpp’]// Returns true if drive is invalid (hope […]
Continue reading…

 

Set/Get caret blinking time

As with double click time Microsoft has provided us with easy to use APIs to set and get a caret’s blink time (time taken to invert caret pixels so that it looks like blinking). Use SetCaretBlinkTime( MilliSeconds ) to set blink time and use GetCaretBlinkTime() to get blink time.
Continue reading…