How to set the local IP address?

Source: Internet
Author: User
Guidance:

You can change the IP address location.


On NT, first obtain the name of the network device driver:
Snetcardregkey: = '/software/Microsoft/Windows NT/CurrentVersion/networkcards/1'; 1 or other sub-keys that can be enumerated in this place
Regrootkey. rootkey: = HKEY_LOCAL_MACHINE;
Regrootkey. openkeyreadonly (snetcardregkey );
Snetcarddrivername: = regrootkey. readstring ('servicename ');

Then:
Sserviceregkey: = '/system/CurrentControlSet/services /';
Stcpipregkey: = sserviceregkey + snetcarddrivername + '/parameters/tcpip ';
Obtain all IP addresses of the device in 'ipaddress '.
Regrootkey. readbinarydata ('ipaddress', cipaddressarray, 255 );
Obtain the subnet mask corresponding to the IP address in 'subnetmask '.
Regrootkey. readbinarydata ('subnetmask', cnetmaskarray, 255 );

IN Win95/98:
How to obtain the device name:
Snetcardregkey: = '/Enum/Network/mstcp/0001/'; 0001 or other sub-keys that can be enumerated here
Sserviceregkey: = '/system/CurrentControlSet/services/class /';

Regrootkey. rootkey: = HKEY_LOCAL_MACHINE;
Regrootkey. openkeyreadonly (snetcardregkey );
Snetcarddrivername: = regrootkey. readstring ('driver ');

Then:
Stcpipregkey: = sserviceregkey + snetcarddrivername;
Regrootkey. openkeyreadonly (stcpipregkey );

Finally, obtain the IP address and subnet mask:
Sipaddress: = regrootkey. readstring ('ipaddress ');
Snetmask: = regrootkey. readstring ('ipmask ');
Win95 does not support multiple addresses of a device.

This article is transferred from
Http://topic.csdn.net/t/20021124/14/1201306.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.