How to find hard disk serial number ?

How to find hard disk serial number ?

If you want to get the hard drive serial number or computer unique number then use this function.
This is Visual Basic 6.0 Code to Get the Computer Hard Drive Serial Number.

‘Computer Unique No or hard drive serial number From Visual Basic

Private Declare Function GetVolumeInformation _
Lib "kernel32.dll" _
Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long

This Function will return serial number of a Drive

Public Function GetSerialNumber(DriveLetter As String) As String
Dim SerialNum As Long
Dim VolNameBuf As String
Dim FileSysNameBuf As String

Select Case Len(DriveLetter)
Case 1
If DriveLetter Like "[a-z]" Then
DriveLetter = Left$(DriveLetter, 1) & ":\"
Else
GetSerialNumber = "Error - Bad drive designation"
End If
Case 2
If LCase(DriveLetter) Like "[a-z]:" Then
DriveLetter = DriveLetter & "\"
Else
GetSerialNumber = "Error - Bad drive designation"
End If
Case 3
If LCase(DriveLetter) Like "[!a-z]:\" Then
GetSerialNumber = "Error - Bad drive designation"
End If
Case Else
GetSerialNumber = "Error - Bad drive designation"
End Select
If Len(GetSerialNumber) = 0 Then
VolNameBuf = String$(255, Chr$(0))
FileSysNameBuf = String$(255, Chr$(0))
GetVolumeInformation DriveLetter, VolNameBuf, _
Len(VolNameBuf), SerialNum, 0, 0, _
FileSysNameBuf, Len(FileSysNameBuf)
GetSerialNumber = Right$("00000000" & Hex$(SerialNum), 8)
End If
End Function

This is good for security purpose. some time if you want to run your EXE file on some computer only then this is the best way.

Send SMS using AT command

Send SMS using GSM modem from your computer. This Example shows you to use AT command to handle the GSM modem.
Try this to send SMS using this example.

1- Insert a form in VB project
2- Insert textbox (txtMsg,txtDestinationNumber)
3- Insert command button (Command1)
4- Insert a MSComm1
5- Connect your mobile phone in computer with datacable

Private Sub Command1_Click()
Call SENDSMS
End Sub

Sub SENDSMS()
On Error GoTo Errr:
If MsgBox("Are you sure to send SMS Message", vbYesNo) = vbNo Then
    Exit Sub
End If
' Set up the communications port
MSComm1.CommPort = 5 ' Com Port 5
' Set for 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
MSComm1.Output = "AT" & Chr$(13)
' Set up the phone for a text message
MSComm1.Output = "AT+CMGF=1" & Chr$(13)
MSComm1.Output = "AT+CMGS= " & Chr(34) & txtDestinationNumber.Text & Chr(34) & Chr$(13) & Chr(10)
MSComm1.Output = txtMsg.Text & Chr$(26)
MSComm1.PortOpen = False
MsgBox "Message Sent successfully"
Exit Sub
Errr:
MsgBox Err.Description & Err.Number, vbExclamation

End Sub