Skip to main content

 none
What is the URI for Reseting Network page in Windows 10? RRS feed

Answers

  • Sorry, i do not understand how to do it.

    A test in C# on Windows 10 (must be modified because I hardcoded the window title "Paramètres" (in french, apparently "Settings" in english from Google...))

    Add a reference to UIAutomationClient.dll and UIAutomationTypes.dll

    +

    using System.Windows.Automation;

    using (Process exeProcess = new Process())
    {
        exeProcess.StartInfo.FileName = "ms-settings:network-status";               
        exeProcess.Start();
        // exeProcess.WaitForInputIdle();
        System.Threading.Thread.Sleep(500); 
    }
    // Not minimized test
    IntPtr hWnd = FindWindow("ApplicationFrameWindow", "Paramètres");
    if (hWnd != IntPtr.Zero)
    {
        IntPtr hWndChild = FindWindowEx(hWnd, IntPtr.Zero, "Windows.UI.Core.CoreWindow", "Paramètres");
        if (hWndChild != IntPtr.Zero)
        {
            AutomationElement element = AutomationElement.FromHandle(hWndChild);
            AutomationElement elementchild1 = element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "ItemsControlScrollViewer"));
            AutomationElement elementchild2 = elementchild1.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "SystemSettings_Connections_PushButtonReset_HyperlinkButton"));
            object buttonPattern = null;
            if (elementchild2.TryGetCurrentPattern(InvokePattern.Pattern, out buttonPattern))
            {
                System.Threading.Thread.Sleep(100);
                ((InvokePattern)buttonPattern).Invoke();
            }
        }
    }

    • Marked as answer by gaxjyxq Tuesday, March 27, 2018 9:19 PM
    Tuesday, March 27, 2018 2:57 PM

All replies

  • Hi,

    Thank you for posting here.

    As far as I know that the URI is Uniform Resource Identifier (URI) scheme name.

    The Network URI is ms-settings:network-ethernet . you can press win+R key, then input the ms-settings:network-ethernet command line.

    Both Windows desktop apps and Universal Windows Platform (UWP) apps can register to be a default handler for a URI scheme name. If the user chooses your app as the default handler for a URI scheme name, your app will be activated every time that type of URI is launched.

    For more information, please refer to the following document.

    https://docs.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation

    https://docs.microsoft.com/en-us/windows/uwp/launch-resume/launch-settings-app
    Best Regards,

    Hart


    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.

    Tuesday, March 27, 2018 8:42 AM
    Moderator
  • Thank you for your reply, i known the URI, i want to open the "Reset Network" sub page in Network status setting page.
    Tuesday, March 27, 2018 11:29 AM
  • It is possible to open it with UI Automation, from ms-settings:network-status
     and AutomationId = "SystemSettings_Connections_PushButtonReset_HyperlinkButton"
     (I only tested with MS Inspect tool, not from code...)
    Tuesday, March 27, 2018 11:46 AM
  • Sorry, i do not understand how to do it.
    Tuesday, March 27, 2018 1:04 PM
  • Sorry, i do not understand how to do it.

    A test in C# on Windows 10 (must be modified because I hardcoded the window title "Paramètres" (in french, apparently "Settings" in english from Google...))

    Add a reference to UIAutomationClient.dll and UIAutomationTypes.dll

    +

    using System.Windows.Automation;

    using (Process exeProcess = new Process())
    {
        exeProcess.StartInfo.FileName = "ms-settings:network-status";               
        exeProcess.Start();
        // exeProcess.WaitForInputIdle();
        System.Threading.Thread.Sleep(500); 
    }
    // Not minimized test
    IntPtr hWnd = FindWindow("ApplicationFrameWindow", "Paramètres");
    if (hWnd != IntPtr.Zero)
    {
        IntPtr hWndChild = FindWindowEx(hWnd, IntPtr.Zero, "Windows.UI.Core.CoreWindow", "Paramètres");
        if (hWndChild != IntPtr.Zero)
        {
            AutomationElement element = AutomationElement.FromHandle(hWndChild);
            AutomationElement elementchild1 = element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "ItemsControlScrollViewer"));
            AutomationElement elementchild2 = elementchild1.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "SystemSettings_Connections_PushButtonReset_HyperlinkButton"));
            object buttonPattern = null;
            if (elementchild2.TryGetCurrentPattern(InvokePattern.Pattern, out buttonPattern))
            {
                System.Threading.Thread.Sleep(100);
                ((InvokePattern)buttonPattern).Invoke();
            }
        }
    }

    • Marked as answer by gaxjyxq Tuesday, March 27, 2018 9:19 PM
    Tuesday, March 27, 2018 2:57 PM
  • This method is troublesome, but it may be the only way. Thank you.
    Tuesday, March 27, 2018 9:19 PM