Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
If you want to create an Windows application with Visual Basic and your app have to be able to run some Windows-side commands you better use CMD.
You can use CMD for accessing IPCONFIG, CHKDSK, DISKPART and many more resources.
Here you have a Visual basic 2012 IPCONFIG RENEW and Release Implementing:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Dim strExecute As String
Dim taskId As Long
'release the current configuration
strExecute = "ipconfig /release"
'execute the command, returning the task_id
taskId = Shell(strExecute, vbHide)
'renew the current configuration
strExecute = "ipconfig /renew"
'execute the command, returning the task_id
taskId = Shell(strExecute, vbHide)
Catch Ex As Exception
End Try
End Sub
Private Const WAIT_INFINITE = -1&
Private Const SYNCHRONIZE = &H100000
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
End Class