回答編集履歴
1
if((int)hWndDialog != 0) を if(hWndDialog != IntPtr.Zero) に改めました。
answer
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
{
|
18
18
|
IntPtr hWndDialog;
|
19
19
|
hWndDialog = FindWindow("NUIDialog", "Microsoft Excel");
|
20
|
-
if (
|
20
|
+
if (hWndDialog != IntPtr.Zero) {
|
21
21
|
AutomationElement elemDialog;
|
22
22
|
elemDialog = AutomationElement.FromHandle(hWndDialog);
|
23
23
|
FindElement(elemDialog, "保存しない");
|