3

What I want to achieve: We are running a program (Dynamics NAV) on a server which sometimes throws an error and therefor isn't running along until you close this error message with "OK". I want to write a program that automatically closes the error window.

I know how to get all open windows with EnumWindows (https://msdn.microsoft.com/de-de/library/windows/desktop/ms633497(v=vs.85).aspx)

private void GetWindows()
{
    listBox_OpenWindows.Items.Clear();
    foreach (KeyValuePair<IntPtr, string> window in OpenWindowGetter.GetOpenWindows())
    {
        IntPtr handle = window.Key;
        string title = window.Value;

        listBox_OpenWindows.Items.Add(title + " (" + handle + ")");
    }
}

Is there a way to get the content of a selected window (with it's handle)?

Thank you

Gilad Green
  • 36,708
  • 7
  • 61
  • 95

0 Answers0