Home / Uncategorized / Baca hardware komputer dg VB

Baca hardware komputer dg VB

Salam kenal dan jumpa lagi dengan saya

Salam kenal dan jumpa lagi dengan mbahsomo

Kali ini mbah akan sedikit memberikan Trik Buat teman2 agar program teman2 dapat membaca hardware kompie

Langsung aja buka Project baru Visual Basic lalu kopikan source di bawah pada Form

Option Explicit

Dim awal As String

Dim a1 As String

Dim a2 As String

Dim kunci As String

Private Declare Function GetVolumeInformation Lib "kernel32" _

Alias "GetVolumeInformationA" _

(ByVal lpRootPathName As String, _

ByVal lpVolumeNameBuffer As String, _

ByVal nVolumeNameSize As Long, _

lpVolumeSerialNumber As Long, _

lpMaximumComponentLength As Long, _

lpFileSystemFlags As Long, _

ByVal lpFileSystemNameBuffer As String, _

ByVal nFileSystemNameSize As Long) As Long

Dim kal(0 To 16) As String

Public Function QueryValue(lPredefinedKey As Long, sKeyName As String, sValueName As String)

 

Dim lRetVal As Long 'result of the API functions

Dim hKey As Long 'handle of opened key

Dim vValue As Variant 'setting of queried value

lRetVal = RegOpenKeyEx(lPredefinedKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)

lRetVal = QueryValueEx(hKey, sValueName, vValue)

'MsgBox vValue

QueryValue = vValue

RegCloseKey (hKey)

End Function

Private Function GetSerialNumber() As Long

Dim lVolumeID As Long

Dim nRet As Long

Dim VolName As String

Dim MaxCompLen As Long

Dim VolFlags As Long

Dim VolFileSys As String

VolName = Space$(256)

VolFileSys = Space$(256)

nRet = GetVolumeInformation("C:", VolName, Len(VolName), lVolumeID, _

MaxCompLen, VolFlags, VolFileSys, Len(VolFileSys))

GetSerialNumber = lVolumeID ' Serial Number

End Function

Untuk penggunaannya misalkan

Private Sub CommandButton1_Click()

MsgBox (GetSerialNumber)

End Sub

Ok jadi deh programnnya

Jika sakit berlanjut hubungi dokter jika program tidak berjalan hubungi [email protected]

By mbahsomo

About Administrator

2016-01-12 10:32:36 2016-01-12 14:33:42

Check Also

download seluruh file dari directory website dengan wget

Sudah lama saya tidak menulis artikel lagi dikarenakan kesibukan, kali ini saya akan sedikit  menulis …

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *