Archive for the 'Visual Basic' Category
Screen capture
Screen capture using Visual Basic
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Function CaptureScreen(ByVal myFile As String) As Boolean
On Error GoTo ErrorHandler ‘Check if the file Exists If Dir(myFile) <> "" Then Exit Function ‘capture the complete screen Call keybd_event(vbKeySnapshot, 1, [...]
[ Back to top ]
change computer name
change computer name using Visual Basic
Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long
Dim strComputerName as stringDim lngReturn as Long
strComputerName = "New name " lngReturn = SetComputerName(strComputerName)
Bookmark It
Hide Sites
[ Back to top ]
List all processor properties in a text box
This Visual Basic example lists all of the processor properties in a text box
Sub ProcessorProperties()
Dim objWMIService, colItems Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor", , 48) For Each objItem In colItems Text1.Text = "AddressWidth: " & objItem.AddressWidth & vbNewLine Text1.Text = Text1.Text & "Architecture: " & objItem.Architecture [...]
[ Back to top ]
This Visual Basic example will display your IP address using WMI
Private Sub Form_Load()‘add a reference to the Microsoft WMI Scripting 1.2 libraryOn Error Resume NextstrComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration", , 48)For Each objItem In colItems‘Form1.Print "IPAddress: " & objItem.IPAddressMsgBox ("IPAddress: " & objItem.IPAddress)NextEnd Sub
Bookmark [...]
[ Back to top ]



























