Click here to Skip to main content
15,922,325 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalhello anybody can solve it Pin
Anonymous4-Apr-05 3:17
Anonymous4-Apr-05 3:17 
GeneralRe: hello anybody can solve it Pin
Jim Matthews4-Apr-05 4:52
Jim Matthews4-Apr-05 4:52 
GeneralRe: hello anybody can solve it Pin
Anonymous4-Apr-05 19:41
Anonymous4-Apr-05 19:41 
GeneralDataset Help Pin
nitin_ion4-Apr-05 1:56
nitin_ion4-Apr-05 1:56 
GeneralXML Didn't post Pin
Colin Angus Mackay4-Apr-05 2:32
Colin Angus Mackay4-Apr-05 2:32 
GeneralRe: XML Didn't post Pin
nitin_ion4-Apr-05 17:22
nitin_ion4-Apr-05 17:22 
GeneralCPU ID and Mac address Pin
Dile4-Apr-05 1:39
Dile4-Apr-05 1:39 
GeneralRe: CPU ID and Mac address Pin
Anonymous4-Apr-05 15:21
Anonymous4-Apr-05 15:21 
==================================
Something like this:
==================================

Imports System
Imports System.Globalization
Imports System.Threading
Imports System.Resources
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Reflection
Imports System.Text

Public Class Fingerprint

Public Function Value() As String
Return pack(cpuId() + biosId() + diskId() + baseId() + videoId() + macId())
End Function



Private Function identifier(ByVal wmiClass As String, ByVal wmiProperty As String, ByVal wmiMustBeTrue As String) As String
Dim result As String = ""
Dim mc As System.Management.ManagementClass = New System.Management.ManagementClass(wmiClass)
Dim moc As System.Management.ManagementObjectCollection = mc.GetInstances()
Dim mo As System.Management.ManagementObject
For Each mo In moc
If mo(wmiMustBeTrue).ToString() = "True" Then
If result = "" Then
Try
result = mo(wmiProperty).ToString()
Exit For
Catch

End Try
End If

End If
Next
Return result
End Function

Private Function identifier(ByVal wmiClass As String, ByVal wmiProperty As String) As String
Dim result As String = ""
Dim mc As System.Management.ManagementClass = New System.Management.ManagementClass(wmiClass)
Dim moc As System.Management.ManagementObjectCollection = mc.GetInstances()

For Each mo As System.Management.ManagementObject In moc

If (result = "") Then
Try
result = mo(wmiProperty).ToString()
Catch
End Try
End If
Next
Return result
End Function

Private Function cpuId() As String
'Uses first CPU identifier available in order of preference
'Don't get all identifiers, as very time consuming
Dim retVal As String = identifier("Win32_Processor", "UniqueId")
If retVal = "" Then
retVal = identifier("Win32_Processor", "ProcessorId")

If retVal = "" Then
retVal = identifier("Win32_Processor", "Name")


If retVal = "" Then
retVal = identifier("Win32_Processor", "Manufacturer")
End If

'Add clock speed for extra security
retVal += identifier("Win32_Processor", "MaxClockSpeed")
End If
End If

Return retVal

End Function

Private Function biosId() As String
Return identifier("Win32_BIOS", "Manufacturer") + identifier("Win32_BIOS", "SMBIOSBIOSVersion") + identifier("Win32_BIOS", "IdentificationCode") + identifier("Win32_BIOS", "SerialNumber") + identifier("Win32_BIOS", "ReleaseDate") + identifier("Win32_BIOS", "Version")
End Function

Private Function diskId() As String
Return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads")
End Function

Private Function baseId() As String
Return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber")
End Function

Private Function videoId() As String
Return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name")
End Function


Private Function macId() As String
Return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled")
End Function


Private Function pack(ByVal text As String) As String
Dim retVal As String
Dim x As Integer = 0
Dim y As Integer = 0
Dim n As Char
For Each n In text
y += 1
x += (AscW(n) * y)
Next

retVal = x.ToString() + "00000000"

Return retVal.Substring(0, 8)
End Function
End Class

GeneralCustom button Pin
kurtvandoorne4-Apr-05 1:36
kurtvandoorne4-Apr-05 1:36 
GeneralRe: Custom button Pin
Mitch F.4-Apr-05 7:49
Mitch F.4-Apr-05 7:49 
GeneralVB vs C++ for COM Development Pin
Anonymous4-Apr-05 0:02
Anonymous4-Apr-05 0:02 
GeneralSimple VB Code Pin
firestar_3x3-Apr-05 23:41
firestar_3x3-Apr-05 23:41 
GeneralCan U help me on this? Pin
abeyphier4-Apr-05 3:54
abeyphier4-Apr-05 3:54 
GeneralDatagrid Selection by Row Pin
Sniper6663-Apr-05 20:12
Sniper6663-Apr-05 20:12 
GeneralRe: Datagrid Selection by Row Pin
lata07mahi5-Apr-05 19:46
lata07mahi5-Apr-05 19:46 
GeneralRe: Datagrid Selection by Row Pin
Sniper6666-Apr-05 20:18
Sniper6666-Apr-05 20:18 
GeneralPlease help if you have ever don a project Over A LAN Pin
Anonymous3-Apr-05 19:26
Anonymous3-Apr-05 19:26 
GeneralRe: Please help if you have ever don a project Over A LAN Pin
Colin Angus Mackay4-Apr-05 2:38
Colin Angus Mackay4-Apr-05 2:38 
GeneralRe: Please help if you have ever don a project Over A LAN Pin
Dave Kreskowiak4-Apr-05 8:25
mveDave Kreskowiak4-Apr-05 8:25 
GeneralAutomatically recognizing USB drive is available Pin
j45mw3-Apr-05 16:00
j45mw3-Apr-05 16:00 
GeneralRe: Automatically recognizing USB drive is available Pin
Anonymous3-Apr-05 17:28
Anonymous3-Apr-05 17:28 
GeneralRe: Automatically recognizing USB drive is available Pin
j45mw3-Apr-05 19:47
j45mw3-Apr-05 19:47 
GeneralRe: Automatically recognizing USB drive is available Pin
Anonymous4-Apr-05 19:03
Anonymous4-Apr-05 19:03 
GeneralRe: Automatically recognizing USB drive is available Pin
Anonymous5-Apr-05 5:48
Anonymous5-Apr-05 5:48 
Questionhow to delete items from combobox during run time? Pin
sumit213-Apr-05 7:29
sumit213-Apr-05 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.