Hi, I know that my question is probably too technical, but I need an api or function to obtain a hardware( motherboard, processor) unique serial number.<br>
I really appreciate your help people!
'Flags for GetSystemInfo<br>
Private Const PROCESSOR_INTEL_386 As Long = 386<br>
Private Const PROCESSOR_INTEL_486 As Long = 486<br>
Private Const PROCESSOR_INTEL_PENTIUM As Long = 586<br>
Private Const PROCESSOR_MIPS_R4000 As Long = 4000<br>
Private Const PROCESSOR_ALPHA_21064 As Long = 21064<br>
Private Const PROCESSOR_PPC_601 As Long = 601<br>
Private Const PROCESSOR_PPC_603 As Long = 603<br>
Private Const PROCESSOR_PPC_604 As Long = 604<br>
Private Const PROCESSOR_PPC_620 As Long = 620<br>
Private Const PROCESSOR_HITACHI_SH3 As Long = 10003 'Windows CE<br>
Private Const PROCESSOR_HITACHI_SH3E As Long = 10004 'Windows CE<br>
Private Const PROCESSOR_HITACHI_SH4 As Long = 10005 'Windows CE<br>
Private Const PROCESSOR_MOTOROLA_821 As Long = 821 'Windows CE<br>
Private Const PROCESSOR_SHx_SH3 As Long = 103 'Windows CE<br>
Private Const PROCESSOR_SHx_SH4 As Long = 104 'Windows CE<br>
Private Const PROCESSOR_STRONGARM As Long = 2577 'Windows CE - 0xA11<br>
Private Const PROCESSOR_ARM720 As Long = 1824 'Windows CE - 0x720<br>
Private Const PROCESSOR_ARM820 As Long = 2080 'Windows CE - 0x820<br>
Private Const PROCESSOR_ARM920 As Long = 2336 'Windows CE - 0x920<br>
Private Const PROCESSOR_ARM_7TDMI As Long = 70001 'Windows CE<br>
<br>
Private Const PROCESSOR_ARCHITECTURE_INTEL As Long = 0<br>
Private Const PROCESSOR_ARCHITECTURE_MIPS As Long = 1<br>
Private Const PROCESSOR_ARCHITECTURE_ALPHA As Long = 2<br>
Private Const PROCESSOR_ARCHITECTURE_PPC As Long = 3<br>
Private Const PROCESSOR_ARCHITECTURE_SHX As Long = 4<br>
Private Const PROCESSOR_ARCHITECTURE_ARM As Long = 5<br>
Private Const PROCESSOR_ARCHITECTURE_IA64 As Long = 6<br>
Private Const PROCESSOR_ARCHITECTURE_ALPHA64 As Long = 7<br>
Private Const PROCESSOR_ARCHITECTURE_UNKNOWN As Long = &HFFFF<br>
<br>
Private Const PROCESSOR_LEVEL_80386 As Long = 3<br>
Private Const PROCESSOR_LEVEL_80486 As Long = 4<br>
Private Const PROCESSOR_LEVEL_PENTIUM As Long = 5<br>
Private Const PROCESSOR_LEVEL_PENTIUMII As Long = 6<br>
<br>
Private Const sCPURegKey = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"<br>
<br>
Private Const HKEY_LOCAL_MACHINE As Long = &H80000002<br>
<br>
Private Type SYSTEM_INFO<br>
dwOemID As Long<br>
dwPageSize As Long<br>
lpMinimumApplicationAddress As Long<br>
lpMaximumApplicationAddress As Long<br>
dwActiveProcessorMask As Long<br>
dwNumberOfProcessors As Long<br>
dwProcessorType As Long<br>
dwAllocationGranularity As Long<br>
wProcessorLevel As Integer<br>
wProcessorRevision As Integer<br>
End Type<br>
<br>
Private Declare Sub GetSystemInfo Lib "kernel32" _<br>
(lpSystemInfo As SYSTEM_INFO)<br>
<br>
Private Declare Function RegCloseKey Lib "advapi32.dll" _<br>
(ByVal hKey As Long) As Long<br>
<br>
Private Declare Function RegOpenKey Lib "advapi32.dll" _<br>
Alias "RegOpenKeyA" _<br>
(ByVal hKey As Long, _<br>
ByVal lpSubKey As String, _<br>
phkResult As Long) As Long<br>
<br>
Private Declare Function RegQueryValueEx Lib "advapi32.dll" _<br>
Alias "RegQueryValueExA" _<br>
(ByVal hKey As Long, _<br>
ByVal lpValueName As String, _<br>
ByVal lpReserved As Long, _<br>
lpType As Long, _<br>
lpData As Any, _<br>
lpcbData As Long) As Long<br>
<br>
<br>
Private Sub Command1_Click()<br>
<br>
Dim SI As SYSTEM_INFO<br>
Dim tmp As String<br>
<br>
Call GetSystemInfo(SI)<br>
<br>
Print "Number Of Processors", SI.dwNumberOfProcessors<br>
<br>
Select Case SI.dwProcessorType<br>
Case PROCESSOR_INTEL_386: tmp = "386"<br>
Case PROCESSOR_INTEL_486: tmp = "486"<br>
Case PROCESSOR_INTEL_PENTIUM: tmp = "Pentium"<br>
Case PROCESSOR_MIPS_R4000: tmp = "MIPS 4000"<br>
Case PROCESSOR_ALPHA_21064: tmp = "Alpha"<br>
End Select<br>
<br>
Print "Processor Type", SI.dwProcessorType, tmp<br>
<br>
Select Case SI.wProcessorLevel<br>
Case PROCESSOR_LEVEL_80386: tmp = "Intel 80386"<br>
Case PROCESSOR_LEVEL_80486: tmp = "Intel 80486"<br>
Case PROCESSOR_LEVEL_PENTIUM: tmp = "Intel Pentium"<br>
Case PROCESSOR_LEVEL_PENTIUMII: tmp = "Intel Pentium Pro or Pentium II"<br>
End Select<br>
<br>
Print "Processor Level", SI.wProcessorLevel, tmp<br>
<br>
Print "Processor Revision", SI.wProcessorRevision, _<br>
"Model "; HiByte(SI.wProcessorRevision) & _<br>
", Stepping " & LoByte(SI.wProcessorRevision)<br>
<br>
Print "CPU Speed", , " " & GetCPUSpeed() & " MHz"<br>
<br>
End Sub<br>
<br>
<br>
Private Function GetCPUSpeed() As Long<br>
<br>
Dim hKey As Long<br>
Dim cpuSpeed As Long<br>
<br>
'Open CPU key<br>
Call RegOpenKey(HKEY_LOCAL_MACHINE, sCPURegKey, hKey)<br>
<br>
'and retrieve the value<br>
Call RegQueryValueEx(hKey, "~MHz", 0, 0, cpuSpeed, 4)<br>
Call RegCloseKey(hKey)<br>
<br>
GetCPUSpeed = cpuSpeed<br>
<br>
End Function<br>
<br>
<br>
Public Function HiByte(ByVal wParam As Integer) As Byte<br>
<br>
'note: VB4-32 users should declare this function As Integer<br>
HiByte = (wParam And &HFF00&) \ (&H100)<br>
<br>
End Function<br>
<br>
<br>
Public Function LoByte(ByVal wParam As Integer) As Byte<br>
<br>
'note: VB4-32 users should declare this function As Integer<br>
LoByte = wParam And &HFF& <br>
<br>
End Function<br>
<br>
<br>
Eric De Decker
I have a question that I think is related to the above
basically I am looking for VB APIs that either tell me when a Print job is finisjhed or can generate a Postscript file(Print to file manually)
I am trying to automate the process
any help is appreciated
thanks
anu
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.