Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Programmatically get System Info?

56 views
Skip to first unread message

Ben Hoffmann

unread,
Sep 17, 2004, 11:53:42 PM9/17/04
to

Question:

How can i write code to get info about the system?

For example, in VB6, you can go to Help / About MS Visual Basic / System
Info, and get a window showing a system summary with things like
Processor, BIOS version, System Mfc, etc.

I would like to write code that would fetch and capture this type of info.

Is this possible with Visual Basic, or do I need to get into other kinds
of code or interfaces?

Thanks in advance for pointing me in the right direction!

- Ben

Norm Cook

unread,
Sep 18, 2004, 10:56:54 AM9/18/04
to
If you start a project & chose Project|Add Form then select the About Dialog, you'll get a form that has code to do this.

If this doesn't do it for you, research WMI scripting.

"Ben Hoffmann" <bens...@skypoint.com> wrote in message news:xNCdnVKwVrL...@skypoint.com...

John Flynn

unread,
Sep 18, 2004, 6:50:11 PM9/18/04
to
The information you need is in various keys of the registry. You will
want to use the RegOpenKeyEx, RegQueryValueEx, and RegCloseKey APIs to
access this data.

You can also have a look at this application:
http://www.karenware.com/powertools/ptprofiler.asp

It's a program called the Computer Profiler and gives you access to
almost any information you would ever want. She gives you the VB6 code
there as well so it is a pretty simple process to go through there and
see what is needed to get any specifc piece of data.

Good Luck,
John

Check out our new forum for all your VB and .NET questions:
http://www.windowsdev.net/forums/

Ben Hoffmann <bens...@skypoint.com> wrote in message news:<xNCdnVKwVrL...@skypoint.com>...

Ben Hoffmann

unread,
Sep 19, 2004, 10:59:17 AM9/19/04
to

Thanks John and Norm for your replies and also to anyone yet to respond
- both replies are very helpful.

Thanks,
- Ben

Michael B. Johnson

unread,
Sep 20, 2004, 11:02:24 AM9/20/04
to
On Fri, 17 Sep 2004 22:53:42 -0500, Ben Hoffmann
<bens...@skypoint.com> wrote:

>Question:
>
>How can i write code to get info about the system?

There's an API call...

Private Declare Sub GetSystemInfo Lib "kernel32.dll" (ByRef
lpSystemInfo As SYSTEM_INFO)

...that should give you processor information.

<msdn>
SYSTEM_INFO
The SYSTEM_INFO structure contains information about the current
computer system. This includes the architecture and type of the
processor, the number of processors in the system, the page size, and
other such information.

typedef struct _SYSTEM_INFO {
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;
WORD wReserved;
};
};
DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress;
LPVOID lpMaximumApplicationAddress;
DWORD_PTR dwActiveProcessorMask;
DWORD dwNumberOfProcessors;
DWORD dwProcessorType;
DWORD dwAllocationGranularity;
WORD wProcessorLevel;
WORD wProcessorRevision;
} SYSTEM_INFO;

Members
=======
dwOemId
An obsolete member that is retained for compatibility with Windows NT
3.5 and earlier. New applications should use the
wProcessorArchitecture branch of the union.
Windows 95/98: The system always sets this member to zero, the value
defined for PROCESSOR_ARCHITECTURE_INTEL.

wProcessorArchitecture
Specifies the system's processor architecture. This value can be one
of the following values:
PROCESSOR_ARCHITECTURE_INTEL
Windows NT/2000: PROCESSOR_ARCHITECTURE_MIPS
Windows NT/2000: PROCESSOR_ARCHITECTURE_ALPHA
Windows NT/2000: PROCESSOR_ARCHITECTURE_PPC
Windows NT/2000: PROCESSOR_ARCHITECTURE_UNKNOWN

wReserved
Reserved for future use.
dwPageSize
Specifies the page size and the granularity of page protection and
commitment. This is the page size used by the VirtualAlloc function.
lpMinimumApplicationAddress
Pointer to the lowest memory address accessible to applications and
dynamic-link libraries (DLLs).
lpMaximumApplicationAddress
Pointer to the highest memory address accessible to applications and
DLLs.
dwActiveProcessorMask
Specifies a mask representing the set of processors configured into
the system. Bit 0 is processor 0; bit 31 is processor 31.
dwNumberOfProcessors
Specifies the number of processors in the system.
dwProcessorType
An obsolete member that is retained for compatibility with Windows NT
3.5 and earlier. Use the wProcessorArchitecture, wProcessorLevel, and
wProcessorRevision members to determine the type of processor.
Windows 95/98: Specifies the type of processor in the system. This
member is one of the following values:

PROCESSOR_INTEL_386
PROCESSOR_INTEL_486
PROCESSOR_INTEL_PENTIUM

dwAllocationGranularity
Specifies the granularity with which virtual memory is allocated. For
example, a VirtualAlloc request to allocate 1 byte will reserve an
address space of dwAllocationGranularity bytes. This value was hard
coded as 64K in the past, but other hardware architectures may require
different values.
wProcessorLevel
Windows NT/2000: Specifies the system's architecture-dependent
processor level. If wProcessorArchitecture is
PROCESSOR_ARCHITECTURE_INTEL, wProcessorLevel can be one of the
following values. Value Meaning
3 Intel 80386
4 Intel 80486
5 Intel Pentium
6 Intel Pentium Pro or Pentium II


If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_MIPS,
wProcessorLevel is of the form 00xx, where xx is an 8-bit
implementation number (bits 8-15 of the PRId register). The member can
be the following value. Value Meaning
0004 MIPS R4000

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_ALPHA,
wProcessorLevel is of the form xxxx, where xxxx is a 16-bit processor
version number (the low-order 16 bits of a version number from the
firmware). The member can be one of the following values. Value
Meaning
21064 Alpha 21064
21066 Alpha 21066
21164 Alpha 21164

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_PPC,
wProcessorLevel is of the form xxxx, where xxxx is a 16-bit processor
version number (the high-order 16 bits of the Processor Version
Register). The member can be one of the following values. Value
Meaning
1 PPC 601
3 PPC 603
4 PPC 604
6 PPC 603+
9 PPC 604+
20 PPC 620

wProcessorRevision
Windows NT/2000: Specifies an architecture-dependent processor
revision. The following table shows how the revision value is
assembled for each type of processor architecture. Processor Value
Intel 80386 or 80486 A value of the form xxyz.
If xx is equal to 0xFF, y - 0xA is the model number, and z is the
stepping identifier. For example, an Intel 80486-D0 system returns
0xFFD0.

If xx is not equal to 0xFF, xx + 'A' is the stepping letter and yz is
the minor stepping.

Intel Pentium, Cyrix, or NextGen 586 A value of the form xxyy, where
xx is the model number and yy is the stepping. Display this value of
0x0201 as follows:
Model xx, Stepping yy

MIPS A value of the form 00xx, where xx is the 8-bit revision number
of the processor (the low-order 8 bits of the PRId register).
ALPHA A value of the form xxyy, where xxyy is the low-order 16 bits of
the processor revision number from the firmware. Display this value as
follows:
Model A+xx, Pass yy

PPC A value of the form xxyy, where xxyy is the low-order 16 bits of
the processor version register. Display this value as follows:
xx.yy


Remarks
Beginning with Windows NT 3.51, the SYSTEM_INFO structure has changed
as follows:

The dwOemId member has been changed to a union. The union supports a
new way to describe processor architecture, while maintaining
compatibility with Windows 95 and previous versions of Windows NT.
The dwProcessorType member is obsolete on Windows NT/Windows 2000. It
is still used on Windows 95/98.
A previously reserved DWORD member at the end of the structure has
been replaced by the wProcessorLevel and wProcessorRevision members.
Windows 95/98 does not use these members.
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.

See Also
System Information Overview, System Information Structures,
GetSystemInfo, MapViewOfFile, MapViewOfFileEx

Built on Tuesday, November 16, 1999

Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.
See Also
System Information Overview, System Information Structures,
GetSystemInfo, MapViewOfFile, MapViewOfFileEx

</msdn>

>For example, in VB6, you can go to Help / About MS Visual Basic / System
>Info, and get a window showing a system summary with things like
>Processor, BIOS version, System Mfc, etc.
>
>I would like to write code that would fetch and capture this type of info.

_______________________
Michael B. Johnson

0 new messages