回答編集履歴
2
見直しキャンペーン中
test
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
わかりました!!
|
2
2
|
マニフェストに`disableWindowFiltering`の設定がいるようです。
|
3
|
-
|
4
3
|
[c++ - How to get a relational window tree like Spy++ does? - Stack Overflow](https://stackoverflow.com/questions/48613313/how-to-get-a-relational-window-tree-like-spy-does)
|
5
4
|
[アプリケーションマニフェスト - Win32 apps | Microsoft Docs](https://docs.microsoft.com/ja-jp/windows/win32/sbscs/application-manifests#disablewindowfiltering)
|
6
5
|
|
1
見直しキャンペーン中
test
CHANGED
@@ -1,159 +1,77 @@
|
|
1
1
|
わかりました!!
|
2
|
-
|
3
2
|
マニフェストに`disableWindowFiltering`の設定がいるようです。
|
4
3
|
|
5
|
-
|
6
|
-
|
7
4
|
[c++ - How to get a relational window tree like Spy++ does? - Stack Overflow](https://stackoverflow.com/questions/48613313/how-to-get-a-relational-window-tree-like-spy-does)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
5
|
[アプリケーションマニフェスト - Win32 apps | Microsoft Docs](https://docs.microsoft.com/ja-jp/windows/win32/sbscs/application-manifests#disablewindowfiltering)
|
12
6
|
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
8
|
`DllImport`を書くのが面倒だったため↓を使用しました(使わない場合NativeMethods.txtは不要)
|
18
|
-
|
19
9
|
[NuGet Gallery | Microsoft.Windows.CsWin32 0.1.588-beta](https://www.nuget.org/packages/Microsoft.Windows.CsWin32/0.1.588-beta)
|
20
|
-
|
21
|
-
|
22
10
|
|
23
11
|
重要なのは**app.manifest**です。他は好きにしてください。
|
24
12
|
|
25
|
-
|
26
|
-
|
27
|
-
```
|
13
|
+
```cs
|
28
|
-
|
29
14
|
using System;
|
30
|
-
|
31
15
|
using System.Runtime.Versioning;
|
32
|
-
|
33
16
|
using Windows.Win32;
|
34
|
-
|
35
17
|
using Windows.Win32.Foundation;
|
36
18
|
|
37
|
-
|
38
|
-
|
39
19
|
namespace Questions364547
|
40
|
-
|
41
20
|
{
|
42
|
-
|
43
21
|
class Program
|
44
|
-
|
45
22
|
{
|
46
|
-
|
47
23
|
static void Main()
|
48
|
-
|
49
24
|
{
|
50
|
-
|
51
25
|
if (OperatingSystem.IsWindowsVersionAtLeast(5))
|
52
|
-
|
53
26
|
{
|
54
|
-
|
55
27
|
PInvoke.EnumWindows(CallBack, 0);
|
56
|
-
|
57
28
|
}
|
58
|
-
|
59
29
|
}
|
60
30
|
|
61
|
-
|
62
|
-
|
63
31
|
[SupportedOSPlatform("windows5.0")]
|
64
|
-
|
65
32
|
static BOOL CallBack(HWND handle, LPARAM param1)
|
66
|
-
|
67
33
|
{
|
68
|
-
|
69
34
|
unsafe
|
70
|
-
|
71
35
|
{
|
72
|
-
|
73
36
|
fixed (char* chars = new char[256])
|
74
|
-
|
75
37
|
{
|
76
|
-
|
77
38
|
if (PInvoke.GetClassName(handle, chars, 256) == 0) return true;
|
78
39
|
|
79
|
-
|
80
|
-
|
81
40
|
if (new string(chars) != "Windows.Internal.Shell.TabProxyWindow")
|
82
|
-
|
83
41
|
return true;
|
84
|
-
|
85
42
|
}
|
86
43
|
|
87
|
-
|
88
|
-
|
89
44
|
var size = PInvoke.GetWindowTextLength(handle) + 1;
|
90
|
-
|
91
45
|
fixed (char* chars = new char[size])
|
92
|
-
|
93
46
|
{
|
94
|
-
|
95
47
|
if (PInvoke.GetWindowText(handle, chars, size) == 0) return true;
|
96
48
|
|
97
|
-
|
98
|
-
|
99
49
|
Console.WriteLine($"タイトル: {new string(chars)}");
|
100
|
-
|
101
50
|
}
|
102
51
|
|
103
|
-
|
104
|
-
|
105
52
|
return true;
|
106
|
-
|
107
53
|
}
|
108
|
-
|
109
54
|
}
|
110
|
-
|
111
55
|
}
|
112
|
-
|
113
56
|
}
|
114
|
-
|
115
57
|
```
|
116
58
|
|
117
|
-
|
118
|
-
|
119
|
-
app.manifest
|
59
|
+
```xml:app.manifest
|
120
|
-
|
121
|
-
```xml
|
122
|
-
|
123
60
|
<?xml version="1.0" encoding="utf-8"?>
|
124
|
-
|
125
61
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
126
62
|
|
127
|
-
|
128
|
-
|
129
63
|
<asmv3:application>
|
130
|
-
|
131
64
|
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2011/WindowsSettings">
|
132
|
-
|
133
65
|
<disableWindowFiltering>true</disableWindowFiltering>
|
134
|
-
|
135
66
|
</asmv3:windowsSettings>
|
136
|
-
|
137
67
|
</asmv3:application>
|
138
68
|
|
139
|
-
|
140
|
-
|
141
69
|
</assembly>
|
142
|
-
|
143
70
|
```
|
144
71
|
|
145
|
-
|
146
|
-
|
147
|
-
NativeMethods.txt
|
72
|
+
```txt:NativeMethods.txt
|
148
|
-
|
73
|
+
EnumWindows
|
74
|
+
GetClassName
|
75
|
+
GetWindowText
|
76
|
+
GetWindowTextLength
|
149
77
|
```
|
150
|
-
|
151
|
-
EnumWindows
|
152
|
-
|
153
|
-
GetClassName
|
154
|
-
|
155
|
-
GetWindowText
|
156
|
-
|
157
|
-
GetWindowTextLength
|
158
|
-
|
159
|
-
```
|