09-25-2012 12:43 PM
My PC has two network adapter cards and I need to implement a test that disables each of them individually. Is there a way to do the equivalent of these commands...
netsh interface show interface
netsh interface set interface "Local Area Connection" ENABLED
...using Windows SDK function calls? The only other way I know would be to run the commands using system() or LaunchExecutable, dump the results to an output file, and parse the file to see the results. I'd rather be able to do it a neater way.
09-26-2012 10:46 AM
Hi richferrara,
You may get some more feedback on the Windows API functions by posting in the Microsoft Developer Network forums. There appears to be an Enable/Disable network card forum on the MSDN that describes several solutions to trying to implement this action.
In addition, on StackOverflow there is a fairly thorough discussion of trying to perform this action in a forum titled Programatically disable/enable network interface that discusses the complexities of platform specific implementations and behaviors of this functionality.