回答編集履歴
2
追記
answer
CHANGED
@@ -1,4 +1,41 @@
|
|
1
1
|
[VBAでファイル選択ダイアログを自動操作する](http://rabbitfoot.xyz/file-dialog-autmation/)
|
2
2
|
VBAですが参考になるかと
|
3
3
|
|
4
|
-
どのみち、Zuishinさんの仰るとおり、spy++でコントロールなど調べる必要があるかと思います。
|
4
|
+
どのみち、Zuishinさんの仰るとおり、spy++でコントロールなど調べる必要があるかと思います。
|
5
|
+
|
6
|
+
### 追記
|
7
|
+
提示されているコードをそのまま使用して、下記を試しました。
|
8
|
+
```C#
|
9
|
+
class Program
|
10
|
+
{
|
11
|
+
[DllImport("user32.dll")]
|
12
|
+
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
13
|
+
|
14
|
+
[DllImport("user32.dll")]
|
15
|
+
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfeter, string lpszClass, string lpszWindow);
|
16
|
+
|
17
|
+
[DllImport("user32.dll")]
|
18
|
+
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, String lParam);
|
19
|
+
|
20
|
+
|
21
|
+
static void Main(string[] args)
|
22
|
+
{
|
23
|
+
IntPtr hWnd3 = FindWindow("#32770", "名前を付けて保存");
|
24
|
+
string filepath = @"c:\test\test.txt"; // 保存先
|
25
|
+
const uint WM_SETTEXT = 0x000c;
|
26
|
+
IntPtr hChild;
|
27
|
+
IntPtr hEdit;
|
28
|
+
|
29
|
+
hChild = FindWindowEx(hWnd3, IntPtr.Zero, "DUIViewWndClassName", null);
|
30
|
+
hChild = FindWindowEx(hChild, IntPtr.Zero, "DirectUIHWND", null);
|
31
|
+
hChild = FindWindowEx(hChild, IntPtr.Zero, "FloatNotifySink", null);
|
32
|
+
hChild = FindWindowEx(hChild, IntPtr.Zero, "ComboBox", null);
|
33
|
+
|
34
|
+
hEdit = FindWindowEx(hChild, IntPtr.Zero, "Edit", null);
|
35
|
+
// ファイル名を設定する
|
36
|
+
SendMessage(hEdit, WM_SETTEXT, IntPtr.Zero, filepath);
|
37
|
+
|
38
|
+
}
|
39
|
+
}
|
40
|
+
```
|
41
|
+
このコードを「名前を付けて保存」ダイアログが表示されている状態で実行したところ、ファイル名の部分は”c:\test\test.txt”になりました。
|
1
追記
answer
CHANGED
@@ -1,2 +1,4 @@
|
|
1
1
|
[VBAでファイル選択ダイアログを自動操作する](http://rabbitfoot.xyz/file-dialog-autmation/)
|
2
|
-
VBAですが参考になるかと
|
2
|
+
VBAですが参考になるかと
|
3
|
+
|
4
|
+
どのみち、Zuishinさんの仰るとおり、spy++でコントロールなど調べる必要があるかと思います。
|