Note that there are some explanatory texts on larger screens.

plurals
  1. POListing all Network Connections, then managing one
    text
    copied!<p>I'm developing an application in C++ for Windows 7, that sets up a TFTP server to communicate to an embedded device. The device is supposed to be connected directly to the Ethernet port, and it expects a TFTP server on 192.168.1.19 static address.</p> <p>To simplify user experience, I want the following scenario:</p> <ul> <li>present a list of all network connections registered in the system to the user (same list as in "Control Panel\Network and Internet\Network Connections")</li> <li>allow to choose one connection</li> <li>memorize its IPv4 configuration</li> <li>set IPv4 configuration to 192.168.1.19 and 255.255.255.0</li> <li>after TFTP job done, restore original IPv4 configuration</li> </ul> <p>The problem I encountered is a mix of the following:</p> <ul> <li>when no Ethernet cable plugged, neither of GetAdaptersInfo, GetInterfaceInfo, GetAdaptersAddresses list the connection I'm interested in;</li> <li>even if I get that connection, I'm not sure which API to use to set DHCP on/off, static IP, network mask.</li> <li>I tried using netsh, and it works fine, but I don't want to run it from my app, because I don't want to deal with non-English characters in the connection names.</li> </ul> <p>Suggestions welcome, Thanks!</p> <p>===== edit #1</p> <p>Tried WMI query "Select * From Win32_NetworkAdapter Where NetConnectionID = 'Local Area Connection'" -- no IP address in the feedback, although I can see it in the Control Panel connection properties.</p> <p>Queries involving Win32_NetworkConnection don't return anything at all.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload