回答編集履歴

2

追記

2018/09/05 00:36

投稿

YAmaGNZ
YAmaGNZ

スコア10555

test CHANGED
@@ -5,3 +5,77 @@
5
5
 
6
6
 
7
7
  どのみち、Zuishinさんの仰るとおり、spy++でコントロールなど調べる必要があるかと思います。
8
+
9
+
10
+
11
+ ### 追記
12
+
13
+ 提示されているコードをそのまま使用して、下記を試しました。
14
+
15
+ ```C#
16
+
17
+ class Program
18
+
19
+ {
20
+
21
+ [DllImport("user32.dll")]
22
+
23
+ static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
24
+
25
+
26
+
27
+ [DllImport("user32.dll")]
28
+
29
+ static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfeter, string lpszClass, string lpszWindow);
30
+
31
+
32
+
33
+ [DllImport("user32.dll")]
34
+
35
+ static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, String lParam);
36
+
37
+
38
+
39
+
40
+
41
+ static void Main(string[] args)
42
+
43
+ {
44
+
45
+ IntPtr hWnd3 = FindWindow("#32770", "名前を付けて保存");
46
+
47
+ string filepath = @"c:\test\test.txt"; // 保存先
48
+
49
+ const uint WM_SETTEXT = 0x000c;
50
+
51
+ IntPtr hChild;
52
+
53
+ IntPtr hEdit;
54
+
55
+
56
+
57
+ hChild = FindWindowEx(hWnd3, IntPtr.Zero, "DUIViewWndClassName", null);
58
+
59
+ hChild = FindWindowEx(hChild, IntPtr.Zero, "DirectUIHWND", null);
60
+
61
+ hChild = FindWindowEx(hChild, IntPtr.Zero, "FloatNotifySink", null);
62
+
63
+ hChild = FindWindowEx(hChild, IntPtr.Zero, "ComboBox", null);
64
+
65
+
66
+
67
+ hEdit = FindWindowEx(hChild, IntPtr.Zero, "Edit", null);
68
+
69
+ // ファイル名を設定する
70
+
71
+ SendMessage(hEdit, WM_SETTEXT, IntPtr.Zero, filepath);
72
+
73
+
74
+
75
+ }
76
+
77
+ }
78
+
79
+ ```
80
+
81
+ このコードを「名前を付けて保存」ダイアログが表示されている状態で実行したところ、ファイル名の部分は”c:\test\test.txt”になりました。

1

追記

2018/09/05 00:36

投稿

YAmaGNZ
YAmaGNZ

スコア10555

test CHANGED
@@ -1,3 +1,7 @@
1
1
  [VBAでファイル選択ダイアログを自動操作する](http://rabbitfoot.xyz/file-dialog-autmation/)
2
2
 
3
3
  VBAですが参考になるかと
4
+
5
+
6
+
7
+ どのみち、Zuishinさんの仰るとおり、spy++でコントロールなど調べる必要があるかと思います。