回答編集履歴
2
コードコメント補足
answer
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
private void button1_Click(object sender, EventArgs e)
|
24
24
|
{
|
25
25
|
// エクスプローラを開く
|
26
|
+
// C:¥を開いた場合
|
26
27
|
System.Diagnostics.Process.Start("explorer.exe", "c:\\");
|
27
28
|
|
28
29
|
IntPtr hWnd;
|
@@ -31,6 +32,7 @@
|
|
31
32
|
System.Threading.Thread.Sleep(500);
|
32
33
|
|
33
34
|
// ウインドウハンドルを得る
|
35
|
+
// ウインドウタイトルは C:¥になっていると仮定
|
34
36
|
hWnd = FindWindow(null, "C:\\");
|
35
37
|
if((hWnd != null) && (IsWindowVisible(hWnd)))
|
36
38
|
break;
|
1
1行抜けていました\.\.\.
answer
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
12
12
|
[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
13
13
|
private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
|
14
|
+
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
|
14
15
|
private static extern bool IsWindowVisible(IntPtr hWnd);
|
15
16
|
const int WM_CLOSE = 0x0010;
|
16
17
|
|