|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
This project is an attempt to create a utility or tool application that will display all the system information like CPU, OS, Multimedia, etc. The idea behind this application is no different than the one implemented in most of Microsoft’s System Info utility in Office products. But my application takes couple of steps more and displays more info than the available utilities. In this version (V1) of application, following information is displayed.
All these pieces of information have been implemented as separate COM components. The purpose being that these can be utilized as separately as required by any application. I have tried to implement the component as Automation compatible (Dual interfaces) so that these utilities can be used from scripting clients too. The extraction of this information is not a rocket science. All the APIs are available in Win32 SDK. It’s just a matter of knowing what API to use where. So I won’t be going into details of implementation. I will try to list all the APIs used in various components and then you can look for more details in online documentation of Platform SDK. OS VersionThis component has been implemented in SystemOS project. Following APIs are used to extract this information.
If CPUCPU’s approximate speed can be obtained from registry key MemoryThis component has been implemented in SystemMemory project.
You can use MouseThis component has been implemented in SystemMouse project.
You can use StorageThis component has been implemented in SystemStorage project. This extracts information about all the storage devices attached to a system, internal as well as external. You can use following APIs to accomplish the task of extracting the information.
Hard DiskThis component has been implemented in SystemHDisk project. This component extracts information about hard disk partitions only. This is accomplished by checking if the drive type is of DRIVE_FIXED or not. nDriveType = ::GetDriveType (szCurrentDrive);
if (nDriveType == DRIVE_FIXED)
{
.
}
Following APIs are used to extract information.
MultimediaThis component has been implemented in SystemMultiMedia project. This component extracts information about any wave output audio device installed on the system. In the next release of this application, wave input and auxiliary input device information will also be added. Following APIs can be used to extract the information.
For this project, make sure that you are linking with #include <mmsystem.h> #include <mmreg.h> OS Protected FilesThis component has been implemented in SystemProtectFiles project. The
component extracts list of OS files that has been marked as protected. This
feature Windows File Protection (WFP) has been introduced with Windows2000. WFP
prevents the replacement of essential system files installed as part of Windows
2000. Applications should not overwrite these files because they are used by
the system and other applications. Protecting these files prevents application
and operating system failures. All Windows-based applications and their
installation programs should be aware of WFP. Locale InformationTo retrieve locale info there is only one API that you will require,GetLocaleInfo. It is the second parameter
to this call, LCType, which you need to specify to get the specific piece of information you want. There
are about 100 different values you can specify for this information. For more information on all of them, check the
Platform SDK documentation for this API. E.g. If you want to get the English name of the country which was specified
at the time of OS installation, you will use the value LOCALE_SENGCOUNTRY for
LCType in GetLocaleInfo call. I will not describe each and every value. I think
documentation has done this job pretty well. For implementation look in the GetInformation function
call of CLocaleInformation class in SystemLocale project.
MiscThis component has been implemented in SystemMisc project. This component extracts information like logged in User Name, Machine Name, Local Language, etc. Following APIs can be used to get this information.
How To UseSince all these components are COM objects, so make sure
that they are all registered. And then you can make use of the standard hr = CoCreateInstance (CLSID_OSInformation,
0,
CLSCTX_INPROC_SERVER,
IID_IOSInformation,
(void **) &m_pOSInfo
);
if (FAILED (hr)) {
return E_NOINTERFACE;
}
Project CompilationThis whole application is divided into 12 projects.
Initially it was compiled using VC5/6. The project included with this article
is for Visual Studio.NET. You will see a lot of warnings about data loss
thrown by compiler. The reason is that I have enables the option For VC6, open the SystemApplication.dsw file in the SystemApplication folder. And for VS.Net, open the SystemApplication.sln file. The appropriate projects files, DSP (VC6) and VCPROJ (VC7) will automatically get loaded. If you need the workspace/projects for VC6, feel free to send me an email. I will send you the DSPs. I am upgrading this application to add more features like BIOS, Video, Modem, Network, etc. History8 March 2001 - updated source files. 18 April 2001 - updated source files.
|
||||||||||||||||||||||