Automatically set the IP BAT file virtual function overload

Source: Internet
Author: User

When the software starts, it automatically modifies the IP address, which can be automatically called






Overload the InitInstance () function in the project ForcePlate.cpp, and add the initialization function

ShellExecute (NULL, _t ("open"), _t ("1.bat"), NULL, M_strexepath, sw_show);

1.bat File: (Modify IP)

netsh int ip set addr name= "Local Area Connection" Source=static addr=192.168.2.3 mask=255.255.255.0

2.bat file: (Restore)

@echo off
netsh interface ip set address "Local Area Connection" DHCP (//p: "DHCP" is set to obtain an IP address automatically)
netsh interface ip set DNS "Local Area Connection" DHCP








Need to be processed at exit, then overloaded virtual function exitinstance ()








ShellExecute
The function of ShellExecute is to run an external program (either open a registered file, open a directory, print a file, etc.) and have some control over the external program.


BAT file Learning and use: http://jingyan.baidu.com/article/e8cdb32b61e98437052bada9.html






Automatically set the IP BAT file virtual function overload

Related Article

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.