-
Notifications
You must be signed in to change notification settings - Fork 99
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
File and Message Dialogs not Parented to Calling Thread's Window #93
Comments
samangh
added a commit
to samangh/portable-file-dialogs
that referenced
this issue
Mar 12, 2024
`GetActiveWindow()` will return NULL if called asynchronously, as it's calling thread will not have a message loop. To work around this, use `GetForegroundWindow()` if `GetActiveWindow()` is null. This will cause any dialogs to be modal. Fixes samhocevar#82 and samhocevar#93
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both the file dialog and the message dialogs use
GetActiveWindow
to parent the dialogs to the calling window. However, according to https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getactivewindow, this function only returns the active window for the calling thread, and as the use of these Windows APIs are in the asynchronousexecutor
,GetActiveWindow
always returns NULL.I've implemented and tested a fix for this, which can be found in the uploaded file (extension renamed so that I could upload it).
portable-file-dialogs.txt
The text was updated successfully, but these errors were encountered: