怎样用程序修改本机的IP地址?高手请进。

pcman1990 pcman1990 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Windows2000或者WindowsXP环境下,要用程序做到:
(1) 修改本机的IP地址;
(2) 即刻生效,无需重启。

已经尝试过:
(1) 使用IP Hepler APIs。但是,有个问题,注意到AddIPAddress的Remarks:
The IP address created by AddIPAddress is not persistent. The address exists only as long as the adapter object exists. Restarting the computer destroys the address, as does manually resetting the network interface card (NIC). Also, certain PnP events may destroy the address.
所以AddIPAddress和DeleteIPAddress不能满足要求。

(2) 如果直接修改注册表,倒是可以完成IP的修改:
a. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\(Netword Card #),读取ServiceName
b. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\(ServiceName)\Parameters\Tcpip 修改这里TCPIP设置;
c. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Adapters\(ServiceName),读取IpConfig
d. 在IpConfig所示位置(一般是HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Parameters\Interfaces\(ServiceName)),修改那里的TCPIP设置。
但是,修改注册表后,如果用ipconfig看,还是以前的设置,直到重启才生效。感觉好像是要在修改注册表后重新启动某个Service才行,试了一下,没弄出什么结果来。

请各位大虾帮忙看看。谢谢!
...全文

相关推荐

ASP.NET Core_ Cloud-ready, Enterprise Web Application Development

ASP.NET Core_ Cloud-ready, Enterprise Web Application Development

shuafen_bdxl_1

Python实现动态修改Windows系统本地IP地址

下面是一个示例代码,演示了如何使用Python动态修改Windows系统的本地IP地址。WMI是一个Windows管理的基础设施,它提供了许多API来管理Windows系统的各种功能。接下来,我们可以遍历适配器列表,找到我们想要修改的适配器。在这个例子中,我们将假设我们要修改名为"以太网"的适配器。通过使用WMI模块,我们可以连接到WMI服务并操作网络适配器的配置。现在,我们可以使用WMI对象来获取当前系统的网络适配器信息。这是一个基本的示例,你可以根据自己的需求进行修改和扩展。接下来,我们可以使用。

MwDart

ASP.NET Core: Cloud-ready, Enterprise Web Application Development

ASP.NET Core: Cloud-ready, Enterprise Web Application Development by Mugilan T. S. Ragupathi English | 9 Jun. 2017 | ASIN: B072KDVHCS | 1414 Pages | AZW3 | 36.34 MB Create fast, scalable, and high-performance applications with C# and ASP.NET Core About This Book Get first-principle coverage of the latest ASP.NET Core MVC Find out how to bring together the capabilities and features of both Angular 2 and ASP.NET Core Discover common areas you might encounter performance problems with and areas you don't need to worry about Who This Book Is For This book is for developers who want to learn to build web applications using ASP.NET Core, those who want to make a career building web applications using Microsoft technology, and those who are working on other web frameworks and want to learn ASP.NET Core. What You Will Learn Get to know the concepts of ASP.NET MVC Create a Controller with action methods Build a view using several features of the Razor View engine Construct a Model for ASP.NET Core MVC application Find out how the features of ASP.NET Core and Angular 2 perfectly complement each other Handle requests and actions using server-side and client-side Routing Create a Data Model using Entity Framework Core Learn how to use Angular 2 components and master directives Improve performance at the network level and I/O level, and how to optimize the application as a whole Monitor performance as part of Continuous Integration and regression testing In Detail ASP.NET Core is the new, open source, and cross-platform, web-application framework from Microsoft. ASP.NET Core MVC helps you build robust web applications using the Model-View-Controller design. This guide will help you in building applications that can be deployed on non-Windows platforms such as Linux. Starting with an overview of the MVC pattern, you will quickly dive into the aspects that you need to know to get started with ASP.NET. You will learn about the core architecture of model, view, and control. Integrating your application with Bootstrap, validating user input, interacting with databases, and deploying your application are some of the things that you will learn to execute with this fast-paced guide. You will test your knowledge as you build a fully working sample application using the skills you've learned throughout the book. Moving forward, this guide will teach you to combine the impressive capabilities of ASP.NET Core and Angular 2. Not only will you learn how Angular 2 can complement your .NET skills and toolkit, you'll also learn everything you need to build a complete, dynamic single-page application. Find out how to get your data model in place and manage an API, before styling and designing your frontend for an exceptional user experience. You will find out how to optimize your application for SEO, identify and secure vulnerabilities, and how to successfully deploy and maintain your application. From here, you will delve into the latest frameworks and software design patterns to improve your application performance. The course offers premium, highly practical content on the recently released ASP.NET Core, and includes material from the following Packt books: Learning ASP.NET Core MVC Programming, ASP.NET Core and Angular 2, and ASP.NET Core 1.0 High Performance. Style and approach This learning path takes a first-principles approach to help you understand and implement ASP.NET MVC solutions.

DWcsdnNET

ASP.NET Core Cloud-ready Enterprise Web Application Development epub

ASP.NET Core Cloud-ready Enterprise Web Application Development 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

yinkaisheng-nj

ASP.NET Core Cloud-ready Enterprise Web Application Development azw3

ASP.NET Core Cloud-ready Enterprise Web Application Development 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

yinkaisheng-nj
评论 23
收藏 已收藏
分享
返回顶部
pcman1990
VC/MFC 16,551 成员 421,605 内容