title: Pywinauto unable to find/close pop-up window
body: <p><strong>Source code</strong></p>
  
  <pre><code>def is_admin():
      try:
          return ctypes.windll.shell32.IsUserAnAdmin()
      except:
          return False
  
  if is_admin():
      app = Application(backend='uia').start("C:\\Program Files (x86)\\Advantech\\AdamApax.NET Utility\\Program\\AdamNET.exe")
      win = app['Advantech Adam/Apax .NET Utility (Win32) Version 2.05.11 (B19)']
      win.wait('ready')
      win.menu_select("Setup-&gt;Refresh Serial and Ethernet")
      win.top_window().print_control_identifiers(filename="file.txt")
      # win.top_window().OKButton.click_input()  ---------This is what I hope to do
  
  else
      ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
  </code></pre>
  
  <p><strong>Problem Statement</strong></p>
  
  <p>I had to run this application with elevation rights. The above is my code. The problem is I can't identify the window (view in <strong><em>output</em></strong> image) that pops up after selection from menu. I need to close the window. Please excuse the line</p>
  
  <p><code>win.top_window().print_control_identifiers(filename="file.txt")</code></p>
  
  <p>It was meant write the identifiers into a text file because the structure of this code does not display the outputs for me to view. However, since nothing is appended, I guess pywinauto couldn't identify the dialog.</p>
  
  <p>For a clearer understanding, please view the image (input) of when it selects the menu.</p>
  
  <p><a href="https://i.stack.imgur.com/T2jQO.png" rel="nofollow noreferrer">Input</a></p>
  
  <p>Now, it pops up with this dialog (output)</p>
  
  <p><a href="https://i.stack.imgur.com/Dxi1S.png" rel="nofollow noreferrer">Output</a></p>
  
  <p>I've also used spy to identify the caption and it gives:</p>
  
  <p>(<strong>Handle:</strong> 004E07D4, 
  <strong>Caption:</strong> Information, 
  <strong>Class:</strong> #32770(Dialog), 
  <strong>Style:</strong> 94C801C5)</p>
  
  <p><strong><em>Other things I've tried:</em></strong></p>
  
  <p>Besides using <code>win.topwindow()</code>  to identify the dialog, I've used</p>
  
  <pre><code>win[Information].OKButton.click_input()
  win[Information].OK.click_input()
  win[Information].OK.close()
  win[Information].OK.kill(soft=false)
  win.Information.OKButton.click_input()
  win.Information.OK.click_input()
  win.Information.OK.close()
  win.Information.OK.kill(soft=false)
  app[Information] ...... curious if I could discover the new window from original application
  </code></pre>
  
  <p>I've also send keys like enter, space, esc &amp; alt-f4 to close the dialog with libraries like keyboard, pynput &amp; ctypes. It still doesn't work.</p>
  
  <p>Link to download the same application: <a href="http://downloadt.advantech.com/download/downloadsr.aspx?File_Id=1-1NHAMZX" rel="nofollow noreferrer">http://downloadt.advantech.com/download/downloadsr.aspx?File_Id=1-1NHAMZX</a></p>
  
  <p>Any help would be greatly appreciated !</p>