samhocevar / portable-file-dialogs

💬 Portable GUI dialogs library, C++11, single-header
Do What The F*ck You Want To Public License
1.03k stars 99 forks source link

File and Message Dialogs not Parented to Calling Thread's Window #93

Open Voxtric opened 1 year ago

Voxtric commented 1 year ago

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 asynchronous executor, 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