ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

System Information Tool... im stuck...

(1/2) > >>

Codebyte:
So, this summer my dad, who works at a Highschool as the Head Tech Coordinator, has around 150-200 computers that he needs formatted... His problem is that he doesnt want to have to pull information from each computer concerning the stats, write them down and then determine whether to keep it or not... So, I tried working on a little application that will basically collect minimal system information (specific information that he needs) concerning the hardware inside the computers... After the program collects the information, I would like it to Rate the system for me based on how new the CPU is (a.k.a using the wProcessorRevision property)... This "rating" system is still to be determined and not completely accurate... This has given my dad a headache so far and I wanna try to get this done for him as a "half-suprise..." (He's a nerd and he'll love this gift)...

My results:
I wrote some coding to see if I could do this myself...  Here it is:


--- Code: C ---//--------------------------------------------------------------------------- #include <vcl.h>#pragma hdrstop #include "Unit1.h"#include "shellapi.h"#include "stdlib.h"#include "stdio.h"#include "windows.h"//---------------------------------------------------------------------------#pragma package(smart_init)#pragma resource "*.dfm"TForm1 *Form1;bool WindowsVersion(char *os, char *version, char *other);int ProcessorInfo(bool NT, char *processor);//---------------------------------------------------------------------------__fastcall TForm1::TForm1(TComponent* Owner)        : TForm(Owner){}//---------------------------------------------------------------------------bool WindowsVersion( char *os, char *version, char *other){        bool NT = false;        OSVERSIONINFO version_info;        version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);        GetVersionEx(&version_info);         if(version_info.dwMajorVersion < 4)        {                sprintf(os, "Windows NT ");                sprintf(version, "3.x");        }        else        {                sprintf(version, "%d.%d.%04d", version_info.dwMajorVersion, version_info.dwMinorVersion, version_info.dwBuildNumber);        }        switch(version_info.dwPlatformId)        {                case VER_PLATFORM_WIN32s:                  sprintf(os, "%s", "Microsoft Win32s");                  break;                case VER_PLATFORM_WIN32_WINDOWS:                  sprintf(os, "%s", "Microsoft Windows 95/98");                  break;                case VER_PLATFORM_WIN32_NT:                  NT = true;                  switch(version_info.dwMajorVersion)                  {                          case 4: sprintf(os, "%s", "Microsoft Windows NT"); break;                          case 5: sprintf(os, "%s", "Microsoft Windows 2000"); break;                          case 6: sprintf(os, "%s", "Microsoft Windows XP"); break;                          default :                                sprintf(os, "%s", "Microsoft Windows ??");                  }                  break;                default :                  sprintf(os, "%s", "Microsoft Windows ??");        }        sprintf(os, "%s", version_info.szCSDVersion);        return NT;}//---------------------------------------------------------------------------int ProcessorInfo(bool NT, char *processor){        SYSTEM_INFO sys_info;         AnsiString Processor;        AnsiString Level;        GetSystemInfo(&sys_info);        int value;        if(NT == true)        {                switch(sys_info.wProcessorArchitecture)                {                        case PROCESSOR_ARCHITECTURE_INTEL :                                Processor = "Intel";                                switch(sys_info.wProcessorLevel)                                {                                        case 3 : Level = "80386";break;                                        case 4 : Level = "80486";break;                                        case 5 : Level = "Pentium"; break;                                        case 6 :                                                value = HIBYTE(sys_info.wProcessorRevision);                                                ShowMessage(value);                                                switch(value)                                                {                                                        case 1 : Level = "Pentium PRO";                                                                Form1->Shape1->Brush->Color = clRed;                                                                Form1->Label17->Caption = "LOW";                                                                break;                                                        case 3,5 : Level = "Pentium II";                                                                Form1->Shape1->Brush->Color = clRed;                                                                Form1->Label17->Caption = "LOW";                                                                break;                                                        case 6 : Level = "Celeron";                                                                Form1->Shape1->Brush->Color = clRed;                                                                Form1->Label17->Caption = "LOW";                                                                break;                                                        case 7,8,10,11 : Level = "Pentium III";                                                                Form1->Shape1->Brush->Color = clYellow;                                                                Form1->Label17->Caption = "MEDIUM";                                                                break;                                                }                                                break;                                        case 15 : Level = "Pentium 4";                                                Form1->Shape1->Brush->Color = clGreen;                                                Form1->Label17->Caption = "HIGH";                                                break;                                        default : Level = "Unknown";                                }                                break;                }        }        else //win 9x        {                switch(sys_info.dwProcessorType)                {                        case PROCESSOR_INTEL_386 :                                Processor = "Intel"; Level = "80386"; break;                        case PROCESSOR_INTEL_486 :                                Processor = "Intel"; Level = "80486"; break;                        case PROCESSOR_INTEL_PENTIUM :                                Processor = "Intel"; Level = "Pentium"; break;                        default : Processor = "N/A";                }        }         sprintf(processor, "%s %s", Processor.c_str(), Level.c_str());        return sys_info.dwNumberOfProcessors;}//---------------------------------------------------------------------------void __fastcall TForm1::BitBtn1Click(TObject *Sender){  Application->Terminate();     }//---------------------------------------------------------------------------void __fastcall TForm1::FormCreate(TObject *Sender){   //Populate the Form   //Get User   char name[255];   DWORD size = 255;   GetUserName(name, &size);  //Win32 API Call   Label2->Caption = AnsiString(name);    //Get OS Version   char os[255];   char version[255];   char patch[255];   bool NT = WindowsVersion(os, version, patch); //Win32 API Wrapper   Label4->Caption = AnsiString(os);   Label6->Caption = AnsiString(version);    //get the Processor Information   char processor[MAX_PATH];   Label12->Caption = ProcessorInfo(NT, processor);   Label10->Caption = AnsiString(processor);    //Get Memory Now   MEMORYSTATUS memory;   memory.dwLength = sizeof(memory);   GlobalMemoryStatus(&memory);    Label14->Caption = IntToStr((memory.dwTotalPhys/1024)/1024)+" KB";    //Get HDD Space   AnsiString Drive = AnsiString("C:\\");   DWORD spc = 0;   DWORD bps = 0;   DWORD cluster = 0;   DWORD freecluster = 0;   GetDiskFreeSpace(Drive.c_str(), &spc, &bps, &freecluster, &cluster);   unsigned long v1 = (unsigned long)cluster;   unsigned long v2 = (unsigned long)spc;   unsigned long v3 = (unsigned long)bps;   unsigned long volsize = (v1 * v2)/1024 * v3;   String vol = (volsize/1024);   vol = vol.SubString(0,2);    if(volsize > 0)   {           Label16->Caption = IntToStr((volsize/1024)/1024) + "." + vol + " GB";   }   else   {           Label16->Caption = "n/a";   }    }//---------------------------------------------------------------------------
The problem:
-I tried using this on an Intel Pentium III and it wouldn't detect the wProcessorLevel... so the label displays "Intel" only... Doesn't make sense to me... I tried using it on several different computers and the only one that I had luck with was an Intel Pentium 4...

If you don't have time to check this out, thanks for at least reading this... I am looking up stuff right now on the internet but the only problem is that I dont actually understand what needs to be fixed here... I am thinking that something is wrong with the output... not sure tho.. Any Ideas?

EDIT: Forgot to mention im coding this with CodeGear C++ Builder 2007..

techidave:
I also am a tech for a school district with about 250 computers to manage.  I currently use Belarc Advisor to give me this information.  The only problem with Belarc is it won't tell me the specs on the RAM, such as PC3200 or DDR266, etc..  Sometimes it doesn't always give the correct info for the motherboard model but most of time it does.

But I would also be interested in your app or a similar one when you get it working correctly. 

Dave

Shades:
You can try SpiceWorks Desktop http://www.spiceworks.com/...Install it on one system only and it will hunt down a lot specs from all the computers it can reach through the local network. SpiceWorks has a nice web-based interface, is agent-less and very simple to setup.

Two screenshots:



and

steeladept:
Personnally, I would suggest you just get Astra32 instead.  It is occasionally found on Giveawayoftheday (that is how I got it) and it is great.  The part that makes it most useful to you would be that it not only provides a report like Belarc, but it also formats it into a variety of report formats.  You can then use other software to do searches as you desire.  For example, you can export your report to XML and then use a small program to query against the XML.  You could also export it to CSV then import the CSV file into Excel and use the formatting in Excel.  That is just two ways to use it.  Lastly, it seems to me that there is a way to get it to report on all machines in a network if the user account has administrative access to them all, but I can't seem to find that anymore.  None the less, this is a tool that will already do what you are looking for on each computer.

mouser:
Codebyte,  no one is really giving you good programming help.  You might search CodeProject for some code.

Also you say:
EDIT: Forgot to mention im coding this with CodeGear C++ Builder 2007..
--- End quote ---
There are a few good system-information components for Delphi/C++ Builder that you might look into.

Navigation

[0] Message Index

[#] Next page

Go to full version