Disabling Wireless while on network
-
I have a program that disables the wireless NIC when a hard-wired network connection is detected. It works fine but there is one catch - when you want to use wireless later, you have to go to the Network Connections window and click Disable, then Enable to get it working again. People at our company just cannot remember to do this and I would really like to avoid them having to do this if possible. The method of disabling the NIC I have used is roughly:
myMIBIFROW.dwAdminStatus = MIB_IF_ADMIN_STATUS_DOWN; dwError = SetIfEntry(&myMIBIFROW);
It works but one drawback is that the control panel Network Connections window still thinks it is enabled after this. I think this is why you have to click Disable first then Enable to get the wireless going again. So, does anyone know how to programatically simulate a click on the Disable and Enable menu options? Any other tricks to help? BTW - setting the status to up and calling SetIfEntry() did not work. Thanks. Dave