Skip to content

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?

@NicolasArnouts
Copy link

@nashaofu ping

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.

3 participants