vb 恢复IP默认值
本人想用VB恢复IP的默认值,就是把原来指定的IP去掉,请高手指教.多谢! --------------------编程问答-------------------- 9x可以用修改注册表。以后的 好象只能用
rundll32.exe shell32.dll,Control_RunDLL netcpl.cpl,然后手动 --------------------编程问答-------------------- 多谢patrickkong,
希望具体的代码,本人是初学,再一次谢谢 --------------------编程问答-------------------- 这是我调用ODBC的代码
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
Private Const SYNCHRONIZE = &H100000
Private Const INFINITE = &HFFFF
Private Function RunODBCDataSource() As Boolean
Dim lngProcID As Long
Dim lngHwnd As Long
Dim lngReturn As Long
lngProcID = Shell("rundll32.exe shell32.dll,Control_RunDLL odbccp32.cpl", vbNormalFocus)
AppActivate lngProcID
' SendKeys "%d" 'alt+d, add ODBC
' SendKeys "i" 'i, move to informix,
' SendKeys "~" 'return key
'was going to focus on client and default its value to 819, cannot do it as error when empty database name
'in connection tab after given dummy data source name
If lngProcID <> 0 Then
lngHwnd = OpenProcess(SYNCHRONIZE, 0, lngProcID)
DoEvents
If lngHwnd <> 0 Then
lngReturn = WaitForSingleObject(lngHwnd, INFINITE)
CloseHandle lngHwnd
End If
RunODBCDataSource = True
Else
MsgBox "Unable to run " & ODBCADM & ".", vbCritical + vbOKOnly, "Error"
End If
End Function
换下1楼的
rundll32.exe shell32.dll,Control_RunDLL netcpl.cpl --------------------编程问答-------------------- 多谢patrickkong,您好,您可能理解错我的意思了,更多的是我的表达能力不够,我的目的是把原来指定的IP地址去掉,变成自动获得.或者把原来指定的DNS地址去掉,变成自动获得.还望您指教. --------------------编程问答-------------------- 我看了你的。
看一楼。
xp以后的冒是不能,不然发到windows的论坛试试。
权限是首要的。
讲清楚你的os和域,我想当然你有administration 权限。 --------------------编程问答-------------------- 还是多谢patrickkong. --------------------编程问答-------------------- 不客气,你如果是要简单控制,当然用的人知道干什么了。 --------------------编程问答-------------------- patrickkong您太客气了,已麻烦您了.
在注册表"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Inte易做图ces"能见到本机的IP和DNS,我想vb专家肯定能解决我说的问题.但我就没办法.
补充:VB , 网络编程