Tuesday, April 27, 2010

System API Programming

Visual Basic 6 - API Programming on how to get computer name

'Get Computer Name
Declare Function SetComputerName Lib "kernel32" _
Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long

Private Sub cmdChange_Click()
SetComputerName txtNewName.Text
End Sub

' Check if program running
Private Sub Form_Load()

'// Not the best way to check
'// Better to use the FindWindow API

If App.PrevInstance = True Then
MsgBox ("This program is already running.")
End If

End Sub


Post a Comment

Powered by Blogger