How to get handle to a TextBox control inside window in Window 10
<p>I am working on automation to Windows 10 with C#.<br>
One of the tasks is to write data to a TextBox in window called "Add exclusion".  </p>

<p>In order to enter this window:<br>
Open Settings => Update &amp; security => Windows Defender => Add an exclution => Exclude a file extension</p>

<p>I understood that I need to use <code>SendMessage(...)</code> or <code>SetWindowText(...)</code> functions for writing data to a control.<br>
But I need to pass these functions a handle of the control I want to write to.<br>
So I need to use <code>GetDlgItem(hDlg, nIDDlgItem)</code>.<br>
The parameter <code>nIDDlgItem</code> is the control ID but I am not able to find the control ID of the TextBox control in the "Add exclusion" window.  </p>

<p>I used Spy++ but when I put the target icon I received only "Shell_Dialog" class:<br>
<a href="https://i.stack.imgur.com/gJn0t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gJn0t.png" alt="enter image description here"></a></p>

<p>I have only the window handle:<br>
<a href="https://i.stack.imgur.com/ktOt8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ktOt8.png" alt="enter image description here"></a></p>

<p>I need the handle of the TextBox control.  </p>

<p><strong>EDIT (20.6.2016):</strong><br>
I tried to use the Inspect.exe tool from Windows 10 Kit but when I am placing the curoser on the TextBox control it writes me "Access is denied":<br>
<a href="https://i.stack.imgur.com/3JiNI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3JiNI.png" alt="enter image description here"></a>  </p>

<p>References:<br>
<a href="https://stackoverflow.com/questions/1100605/settext-of-textbox-in-external-app-win32-api">SetText of textbox in external app. Win32 API</a><br>
<a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd318521(v=vs.85).aspx" rel="nofollow noreferrer">Inspect (Inspect.exe) is a Windows-based tool that enables you select any UI element</a>  </p>