| 660 | |
| 661 | |
| 662 | BOOL CALLBACK EnumParentFind(HWND aWnd, LPARAM lParam) |
| 663 | // This function must be kept thread-safe because it may be called (indirectly) by hook thread too. |
| 664 | // To continue enumeration, the function must return TRUE; to stop enumeration, it must return FALSE. |
| 665 | // It's a little strange, but I think EnumWindows() returns FALSE when the callback stopped |
| 666 | // the enumeration prematurely by returning false to its caller. Otherwise (the enumeration went |
| 667 | // through every window), it returns TRUE: |
| 668 | { |
| 669 | WindowSearch &ws = *(WindowSearch *)lParam; // For performance and convenience. |
| 670 | if (!ws.mSettings->DetectWindow(aWnd)) // Skip windows the script isn't supposed to detect. |
| 671 | return TRUE; |
| 672 | ws.SetCandidate(aWnd); |
| 673 | // If this window doesn't match, continue searching for more windows (via TRUE). Likewise, if |
| 674 | // mFindLastMatch is true, continue searching even if this window is a match. Otherwise, this |
| 675 | // first match is the one that's desired so stop here: |
| 676 | return ws.IsMatch() ? ws.mFindLastMatch : TRUE; |
| 677 | } |
| 678 | |
| 679 | |
| 680 |
nothing calls this directly
no test coverage detected