Windows Inheritance?  
Author Message
DegreeZ





PostPosted: Visual C# General, Windows Inheritance? Top

Hi,

I have written a fair bit of c# applications. However, they all perform their own functions and always read data within the application. I was always wondering how to work with existing Windows components/data For example, how would you check to see if the user selects the 'Start' button How could you check what processes the user is running How could you tell how much HD space the user has

All help is appreciated!



Visual C#19  
 
 
ahmedilyas





PostPosted: Visual C# General, Windows Inheritance? Top

in regards to what process the user is running, use the Process class, in the System.Diagnostics namespace, to retrieve a list of processes.

Process[] theProcesses = Process.GetProcesses();

This will get you a list of processes the current user is running.

About the HD Space, you can use the DriveInfo class in .NET 2.0. Example:

DriveInfo[] theDrives = DriveInfo.GetDrives();

foreach(DriveInfo currentDrive in theDrives)

{

if (currentDrive.IsReady)

{

MessageBox.Show(currentDrive.AvailableFreeSpace.ToString());

}

}

This will go through each drive its found on the system and report the available free space it has

I hope this helps in some way.