0

I am attempting to determine whether a Window with the Class Name of "Static", CONTAINS "Scan finished." via .NET/C#.

Specifically, I have automated the use of RogueKiller and would like to detect when the "Scan" is done.

I have tried numerous PInvoke methods, but nothing I can find allows me to do (pseudo) Caption.Contains("Scan finished");.

Any help would be wonderful!

The Window Structure Works as:

Parent (RogueKiller™...etc) Windows - Class:Static, Caption: Scan finished. Please look at the different tabs and delete items with the buttons

I need to detect "Scan finished".

Smarter
  • 19
  • 6
  • Which PInvoke methods did you try? GetClassName, GetChild and GetDesktop combos didn't work? – Mike Cheel Aug 13 '14 at 06:12
  • I tried EnumWindows, etc. I am attempting to find a Child Window, and I can find it specifically with exact caption, but the caption can vary, so I need to check if it "Contains" the text. – Smarter Aug 13 '14 at 06:14
  • All windows are children of the desktop (GetDesktop and GetWindow (when I said GetChild)). You can determine the class name using GetClassName. GetWindowText gets the text. – Mike Cheel Aug 13 '14 at 06:16
  • I required a Child Window of a Process, and to detect it's Caption. See updated question. – Smarter Aug 13 '14 at 06:32
  • This is exactly the sort of thing that UI Automation was designed for. You want to trigger when a child element's `Name` changes, then compare the `Name` to your desired string. – Raymond Chen Aug 13 '14 at 06:52
  • Possible duplicate of http://stackoverflow.com/questions/19867402 – Moby Disk Aug 13 '14 at 14:25
  • Use WM_GETTEXTLENGTH -> WM_GETTEXT rather than GetWindowText() as you are cross-process and not looking for a title caption. To find a child window pass the parents HWND to EnumChildWindows(). If you are new to this as suggested you may like to look at UI Automation which abstracts the Win32 stuff. – Alex K. Aug 14 '14 at 09:57

1 Answers1

0

I think you want to call EnumWindows and call GetWindowText in your callback. I hesitate to copy/paste another StackOverflow answer. So for a detailed example, see How can I use EnumWindows to find windows with a specific caption/title?

Community
  • 1
  • 1
Moby Disk
  • 3,761
  • 1
  • 19
  • 38