Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: capture the window of current process #192

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

flisky
Copy link

@flisky flisky commented Feb 13, 2025

According to webrtc, GetWindowTextW is not always safe to call. However, we call it unconditionally now, but exclude the current process window.

I'm trying to use SendMessageTimeoutW as suggested by https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowtexta#remarks, and 500ms is an arbitrary choosed number (50ms doesn't work sometimes). I can revert it if you prefer the old GetWindowTextW since it works just now.

@nashaofu
Copy link
Owner

Will the execution time of this function become longer?

@flisky
Copy link
Author

flisky commented Feb 21, 2025

Well, it depends whether the target window handles message in time, and thus it may be much longer than GetWindowText in theory. (We don't concern about performance too much, because it's very occasional called in our system, and it's drivered by human beings.)

I think we can drop the third commit which changes get_window_title implementation, and merge the first two ones. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants