none
Open Network And Sharing Center programatically without explorer.exe RRS feed

  • Question

  • Is there a way of opening the Network and Sharing Center programatically without explorer.exe running? I am trying to call it from a C# application in a Windows 10 Enterprise environment with a custom shell.

    I am doing something similar for the Network Connections, which involves run32dll

    rundll32 shell32.dll,Control_RunDLL ncpa.cpl

    So the C# code would be

    ProcessStartInfo psInfo = new ProcessStartInfo("rundll32.exe", "shell32.dll,Control_RunDLL ncpa.cpl");
    psInfo.WindowStyle = ProcessWindowStyle.Maximized;
    psInfo.CreateNoWindow = false;
    psInfo.UseShellExecute = false;
    Process proc = new Process();
    proc.StartInfo = psInfo;
    proc.Start();


    However I don't seem to be able to find an equivalent for the Network and Sharing Center.

    I have come across this

    control.exe /name Microsoft.NetworkAndSharingCenter

    So

    ProcessStartInfo psInfo = new ProcessStartInfo("control.exe", "/name Microsoft.NetworkAndSharingCenter");


    This works perfectly when running in my development environment but it appears to depend on explorer.exe to be running - it does nothing when running in the custom shell. While the prior run32dll example works fine either way.

    My goal here is that the user of the application be able to manage Wi-Fi connections. So failing the above, is there another way that they could do this that doesn't rely on explorer.exe?



    • Edited by ColmDec Tuesday, July 7, 2020 8:12 AM
    Tuesday, July 7, 2020 7:44 AM

All replies


  • My goal here is that the user of the application be able to manage Wi-Fi connections. So failing the above, is there another way that they could do this that doesn't rely on explorer.exe?


    You can use Wlan APIs, like WlanEnumInterfaces,  WlanGetAvailableNetworkList and so on


    Tuesday, July 7, 2020 8:00 AM
  • Thanks, I was hoping to use an existing Windows component rather than further development to the application... 
    • Edited by ColmDec Tuesday, July 7, 2020 8:15 AM
    Tuesday, July 7, 2020 8:13 AM
  • Hi,

    Thanks for posting here.

    I use spy++ to get the window of Network and Sharing Center, then got its processid and threadid, and compared the process in Process Explorer. I find that it is only a thread of the explorer.exe, but not a separate process, so if you don’t run the default explorer.exe, then you may need to implement your own process, with the Wlan functions as the comments.

    Best Regards,

    Drake


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 8, 2020 2:23 AM
    Moderator
  • You can try host IExplorerBrowser and navigate to shell:::{8E908FC9-BECC-40f6-915B-F4CA0E70D03D} ... I am not sure the two work together though. 


    Visual C++ MVP

    Friday, July 24, 2020 10:41 PM
    Moderator
  • You can use  WlanEnumInterfaces,  WlanGetAvailableNetworkList etc. These WLAN api's will get your work done.

    Saurav yadav

    Sunday, July 26, 2020 7:13 AM