热情软件屋

 

怎样读取和更改TCP/IP协议的IP地址及子网掩码


编号:QA002387
建立日期: 2000年1月6日 最后修改日期:2000年1月6日
所属类别:

成晖:
    操作系统:win98
    编程工具:vb6
    问题:怎样读取和更改TCP/IP协议的IP地址及子网掩码?是用Windows API吗?请指教,谢谢!

回答:

    I use NT as the develop machine. Here is the solution for NT. I think it should be similiar on Win9x machine.
    REMEMBER: THIS WILL MODIFY REGISTRY AND SERIOUS PROBLEM MAY BE INTRODUCED.
    1. First of all, you should check the service name of your network adaptercard. Here I assume you have one and only one network card installed on your machine. In the registry, get the value of
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
    NT\CurrentVersion\NetworkCards\1\ServiceName.
    2. Find the key of
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\"ServiceName"\Parameters\Tcpip. Replace the "ServiceName" with whatever you get in the step 1.
    3. Change the value of "IpAddress" to change IP address.
    4. Change the value of "SubnetMask" to change subnet mask.
    5. Change the value of "DefaultGateway" to change default gateway.
    6. Don't forget to reboot your machine after you make your changes.

此问题由Xingong回答。

 
把这个问题推荐给朋友
   
   
您的意见类别
您的名字
您的电子邮件
您的建议(请尽可能详细)
 
 

版权所有 1997-2008 热情软件屋
如果您有任何建议和意见, 请给我发个电子邮件 askpro@china-askpro.com
Web Designed by ZebraStudio