windows: capture the window of current process#192
Open
flisky wants to merge 3 commits into
Open
Conversation
Owner
|
Will the execution time of this function become longer? |
Author
|
Well, it depends whether the target window handles message in time, and thus it may be much longer than I think we can drop the third commit which changes |
|
@nashaofu ping |
madcodelife
added a commit
to madcodelife/xcap
that referenced
this pull request
Mar 24, 2026
- Remove exclusion of current process windows - Call `get_window_title` lazily to avoid unnecessary work - Use `SendMessageTimeoutW` (500ms timeout) instead of `GetWindowTextW` to prevent potential deadlocks when capturing cross-process windows Co-Authored-By: Yin Jifeng <jifeng.yin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to
webrtc,GetWindowTextWis not always safe to call. However, we call it unconditionally now, but exclude the current process window.I'm trying to use
SendMessageTimeoutWas suggested by https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowtexta#remarks, and500msis an arbitrary choosed number (50msdoesn't work sometimes). I can revert it if you prefer the oldGetWindowTextWsince it works just now.