{"id":6148,"date":"2015-08-20T17:42:21","date_gmt":"2015-08-20T08:42:21","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6148"},"modified":"2017-08-18T16:05:05","modified_gmt":"2017-08-18T07:05:05","slug":"%e7%b6%9a%e3%83%bb%e8%b5%b7%e5%8b%95%e4%b8%ad%e3%81%aemicrosoft-edge%e3%81%8b%e3%82%89%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e3%81%a8url%e3%82%92%e5%8f%96%e5%be%97%e3%81%99%e3%82%8bc%e3%82%b3%e3%83%bc","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6148","title":{"rendered":"\u7d9a\u30fb\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bC#\u30b3\u30fc\u30c9(UI Automation\u7de8)"},"content":{"rendered":"<p><span style=\"color: #ff0000; font-weight: bold;\">2017\/8\/18 \u8ffd\u8a18\uff1a<\/span><br \/>\n\u5f53\u8a18\u4e8b\u306e\u30b3\u30fc\u30c9\u306f\u73fe\u5728\u52d5\u4f5c\u3057\u306a\u304f\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u65b0\u3057\u304f\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u76f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=9085\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-MicrosoftEdge-120x120.png' alt='\u30102017\u5e748\u6708\u7248\u3011\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bC#\u30b3\u30fc\u30c9' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2017.08.18<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=9085\">\u30102017\u5e748\u6708\u7248\u3011\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bC#\u30b3\u30fc\u30c9 <\/a><\/div><div class=\"cardlink_excerpt\">\u5f53\u30d6\u30ed\u30b0\u3067\u306f\u3001Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u3001\u3044\u304f\u3064\u304b\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u304d\u307e\u3057\u305f\u3002\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\u3057\u304b\u3057\u3001\u73fe\u6642\u70b9(2018\u5e748\u6708)\u3067\u306fEdge\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306b\u4f34\u3044\u3053\u308c\u3089\u306e\u8a18\u4e8b\u306b\u3042\u308b\u30b3\u30fc\u30c9\u304c\u52d5\u4f5c\u3057\u306a\u304f\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u4eca\u56de\u30b3\u30fc\u30c9\u3092\u66f8...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<hr \/>\n<p><a href=\"\/\/www.ka-net.org\/blog\/?p=6145\" title=\"\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bC#\u30b3\u30fc\u30c9(UI Automation\u7de8) | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\u524d\u56de\u306e\u8a18\u4e8b<\/a>\u3067\u3001UI Automation\u3092\u4f7f\u3063\u3066\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bC#\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001\u52d5\u4f5c\u3068\u3057\u3066\u306fEdge\u306e\u30a2\u30c9\u30ec\u30b9\u6b04\u3092\u30d5\u30a9\u30fc\u30ab\u30b9\u3057\u3066\u304b\u3089URL\u3092\u53d6\u5f97\u3059\u308b\u3068\u3044\u3046\u9762\u5012\u306a\u3053\u3068\u3092\u3084\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306b\u5bfe\u3057\u3066\u300c<a href=\"http:\/\/stackoverflow.com\/questions\/31967430\/microsoft-edge-get-window-url-and-title\" title=\".net - Microsoft Edge: Get Window URL and Title - Stack Overflow\" target=\"_blank\">Microsoft Edge: Get Window URL and Title<\/a>\u300d\u3067\u306f\u3001ClassName\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u300cInternet Explorer_Server\u300d\u306ePane\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u304b\u3089CachedName\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53d6\u5f97\u3059\u308b\u5f62\u304c\u3068\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30fc\u30c9\u3092\u898b\u308b\u9650\u308a\u3001\u305f\u3057\u304b\u306b\u30b3\u30c1\u30e9\u306e\u65b9\u304c\u624b\u9593\u304c\u7121\u304f\u3066\u826f\u3044\u3067\u3059\u306d\u3002<br \/>\n(\u5b9f\u306f\u79c1\u3082\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=6076\" title=\"\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(UI Automation\u7de8) | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(UI Automation\u7de8)<\/a>\u300d\u3092\u66f8\u3044\u305f\u3068\u304d\u306b\u540c\u3058\u3088\u3046\u306a\u65b9\u6cd5\u3092\u8a66\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u3068\u304d\u306f\u4f55\u6545\u304bURL\u304c\u9014\u4e2d\u3067\u5207\u308c\u3066\u3057\u307e\u3046\u30da\u30fc\u30b8\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u7d50\u5c40\u30a2\u30c9\u30ec\u30b9\u6b04\u304b\u3089\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306b\u3057\u307e\u3057\u305f\u3002)<\/p>\n<p>\u305f\u3060\u3001\u4e00\u3064\u6c17\u306b\u306a\u308b\u306e\u304c\u4e0b\u8a18\u306e\u4e00\u6587\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u201cThe C# code uses a UIA interop dll that I generated through the tlbimp tool.\u201d<\/span><\/p>\n<p>\u3048\u30fc\uff01\uff1fTlbimp.exe\u3067\u308f\u3056\u308f\u3056DLL\u5410\u304d\u51fa\u3055\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\uff1f\uff1f<br \/>\nVisual Studio\u5165\u308c\u3066\u306a\u3044\u4eba\u306f\u3069\u3046\u3059\u308c\u3070\u826f\u3044\u306e\uff1f\uff1f<\/p>\n<p>\u30fb\u30fb\u30fb\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u4f55\u3068\u304b\u5225\u306e\u65b9\u5411\u304b\u3089\u884c\u3051\u306a\u3044\u304b\u3001\u8abf\u3079\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305a\u3001Inspect\u3067\u5148\u306ePane\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u8abf\u3079\u305f\u3068\u3053\u308d\u3001NativeWindowHandle\u304c<span style=\"color: #ff0000; font-weight: bold;\">0x1005CA<\/span>\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_01.jpg\" alt=\"AutomateMicrosoftEdge_UIA_Csharp_2_01\" width=\"896\" height=\"445\" class=\"alignnone size-full wp-image-6149\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_01.jpg 896w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_01-300x149.jpg 300w\" sizes=\"auto, (max-width: 896px) 100vw, 896px\" \/><\/a><\/p>\n<p>\u3053\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u4f55\u306a\u306e\u304b\u3092Spy++\u3067\u8abf\u3079\u305f\u3068\u3053\u308d\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">Windows.UI.Core.CoreComponentInputSource<\/span>\u300d\u30af\u30e9\u30b9\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u3042\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_02.jpg\" alt=\"AutomateMicrosoftEdge_UIA_Csharp_2_02\" width=\"593\" height=\"608\" class=\"alignnone size-full wp-image-6150\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_02.jpg 593w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_02-293x300.jpg 293w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/a><\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u306f\u3001Edge\u306e\u5b50\u30a6\u30a3\u30f3\u30c9\u30a6\u304b\u3089Windows.UI.Core.CoreComponentInputSource\u30af\u30e9\u30b9\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u5217\u6319\u3057\u3066\u3001\u305d\u3053\u304b\u3089AutomationElement\u3092\u6355\u307e\u3048\u308c\u3070\u826f\u3044\u306e\u3067\u306f\uff1f<\/p>\n<p>\u30fb\u30fb\u30fb\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3055\u3063\u305d\u304f\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b UIAutomationClient, UIAutomationTypes \u8981\u53c2\u7167<\/span><\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">using System;\r\nusing System.Text;\r\nusing System.Runtime.InteropServices;\r\nusing System.Windows.Automation;\r\n\r\nnamespace UIAutomationEdge\r\n{\r\n  class Program\r\n  {\r\n    public delegate bool Win32Callback(IntPtr hwnd, IntPtr lParam);\r\n    &#x5B;DllImport(&quot;user32.Dll&quot;)]\r\n    &#x5B;return: MarshalAs(UnmanagedType.Bool)]\r\n    public static extern bool EnumChildWindows(IntPtr parentHandle, Win32Callback callback, IntPtr lParam);\r\n    \r\n    &#x5B;DllImport(&quot;user32.dll&quot;, CharSet = CharSet.Auto)]\r\n    static public extern IntPtr GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);\r\n    \r\n    &#x5B;DllImport(&quot;user32.dll&quot;, ExactSpelling=true, CharSet=CharSet.Auto)]\r\n    public static extern IntPtr GetParent(IntPtr hWnd);\r\n    \r\n    public static void Main(string&#x5B;] args)\r\n    {\r\n      AutomationElement root = AutomationElement.RootElement;\r\n      AutomationElement edge = root.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, &quot;TitleBar&quot;));\r\n      if (edge != null) {\r\n        edge = edge.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.ClassNameProperty, &quot;Windows.UI.Core.CoreWindow&quot;));\r\n        if (edge != null) {\r\n          Win32Callback childProc = new Win32Callback(EnumWindow);\r\n          EnumChildWindows((IntPtr)edge.Current.NativeWindowHandle, childProc, (IntPtr)0);\r\n          Console.ReadKey(true);\r\n        }\r\n      }\r\n    }\r\n    \r\n    private static bool EnumWindow(IntPtr handle, IntPtr pointer)\r\n    {\r\n      StringBuilder buf = new StringBuilder(255);\r\n      IntPtr ret = GetClassName(handle, buf, buf.Capacity);\r\n      if (ret != IntPtr.Zero) {\r\n        string className = buf.ToString();\r\n        if (className == &quot;Windows.UI.Core.CoreComponentInputSource&quot;) {\r\n          IntPtr hTitle = GetParent(handle);\r\n          AutomationElement title = AutomationElement.FromHandle(hTitle);\r\n          AutomationElement url = AutomationElement.FromHandle(handle);\r\n          Console.WriteLine(title.Current.Name + &quot;, &quot; + url.Current.Name);\r\n        }\r\n      }\r\n      return true;\r\n    }\r\n  }\r\n}<\/pre>\n<p>EnumChildWindows\u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u5217\u6319\u3057\u3066GetClassName\u3067\u30af\u30e9\u30b9\u540d\u3092\u8abf\u3079\u3066\u3044\u304f\u3068\u3044\u3046\u3001\u3053\u308c\u306f\u3053\u308c\u3067\u9762\u5012\u304f\u3055\u3044\u3082\u306e\u3067\u3059\u304c\u3001\u4e00\u5fdc\u4e0b\u56f3\u306e\u901a\u308a\u76ee\u7684\u9054\u6210\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_03.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_03.jpg\" alt=\"AutomateMicrosoftEdge_UIA_Csharp_2_03\" width=\"906\" height=\"481\" class=\"alignnone size-full wp-image-6151\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_03.jpg 906w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_Csharp_2_03-300x159.jpg 300w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"2017\/8\/18 \u8ffd\u8a18\uff1a \u5f53\u8a18\u4e8b\u306e\u30b3\u30fc\u30c9\u306f\u73fe\u5728\u52d5\u4f5c\u3057\u306a\u304f\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u65b0\u3057\u304f\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u76f4\u3057\u307e\u3057\u305f\u3002 \u524d\u56de\u306e\u8a18\u4e8b\u3067\u3001UI Automation\u3092\u4f7f\u3063\u3066\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308b [&hellip;]","protected":false},"author":1,"featured_media":7115,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u98fd\u304d\u305f\u3068\u8a00\u3044\u3064\u3064\u518d\u5ea6UIA\u3067Edge\u3002 [\u7d9a\u30fb\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bC#\u30b3\u30fc\u30c9(UI Automation\u7de8)]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[132,25,133],"tags":[],"class_list":["post-6148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows10","category-windows","category-microsoft-edge"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-MicrosoftEdge.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1Ba","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6148"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6148\/revisions"}],"predecessor-version":[{"id":9090,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6148\/revisions\/9090"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7115"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}