|
VB 6 Helper Newsletter
|
Rod Stephens
|
Jul 10, 2009 14:02 PDT
|
My hard drive upgrade went smoothly. It's amazing how much space you can
fit in those tiny little things. The new one is 500 GB and would easily
fit in your pocket.
(When I was a kid, my father brought home one of the early removable
disks--a precursor to floppy disks. This one was a package about 14
inches in diameter and about 3 inches thick. It held a single platter
that looked a lot like an LP. I don't know how much data it held but I
bet it was onlky a couple KB.)
----------
I rebuilt all of my XAML examples to fix some typographic problems on
their Web pages. (No one had mentioned these so I wonder if anyone's
looked at them yet.)
----------
My book "Visual Basic 2008 Programmer's Reference" received a couple
more new reviews. Yeah!
----------
Have a great week and thanks for subscribing!
Rod
RodSte-@vb-helper.com
Books To Keep: http://www.BooksToKeep.com
----------
*** Now Available ***
Beginning Database Design Solutions
http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/
Visual Basic 2008 Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
==========
VB6 Contents:
1. New HowTo: Get mother board serial numbers and CPU IDs in Visual
Basic 6
==========
++++++++++
<VB6>
++++++++++
==========
1. New HowTo: Get mother board serial numbers and CPU IDs in Visual
Basic 6
http://www.vb-helper.com/howto_get_cpu_serial_number_id.html
http://www.vb-helper.com/HowTo/howto_get_cpu_serial_number_id.zip
The following function gets a WMI object and then gets a collection of
WMI_BaseBoard objects representing the system's mother boards. It loops
through them getting their serial numbers.
Private Function SystemSerialNumber() As String
Dim mother_boards As Variant
Dim board As Variant
Dim wmi As Variant
Dim serial_numbers As String
' Get the Windows Management Instrumentation object.
Set wmi = GetObject("WinMgmts:")
' Get the "base boards" (mother boards).
Set mother_boards = wmi.InstancesOf("Win32_BaseBoard")
For Each board In mother_boards
serial_numbers = serial_numbers & ", " & board.SerialNumber
Next board
If Len(serial_numbers) > 0 Then serial_numbers =
Mid$(serial_numbers, 3)
SystemSerialNumber = serial_numbers
End Function
The following code gets a WMI object and selects Win32_Processor
objects. It loops through them getting their processor IDs.
Private Function CpuId() As String
Dim computer As String
Dim wmi As Variant
Dim processors As Variant
Dim cpu As Variant
Dim cpu_ids As String
computer = "."
Set wmi = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
computer & "\root\cimv2")
Set processors = wmi.ExecQuery("Select * from Win32_Processor")
For Each cpu In processors
cpu_ids = cpu_ids & ", " & cpu.ProcessorId
Next cpu
If Len(cpu_ids) > 0 Then cpu_ids = Mid$(cpu_ids, 3)
CpuId = cpu_ids
End Function
==========
Archives:
http://www.topica.com/lists/VBHelper
http://www.topica.com/lists/VB6Helper
http://www.topica.com/lists/VBNetHelper
Post questions at:
http://www.topica.com/lists/VBHelperQA
|
|
 |
|