PolyMeilex / rfd

Rusty File Dialog
MIT License
524 stars 60 forks source link

window: message dialog not in foreground when launched from a window-less process #203

Open benma opened 5 days ago

benma commented 5 days ago

Hi

This is exactly the crate I needed to prompt the user with a message. However, my process on runs in the background without a main window.

On Windows, the dialog appears in the background (behind other open windows like browser, etc.). It is visible in the task bar, but the user is not going to notice this easily. Is there a way to open the dialog in the foreground, or to add support for this somehow?

benma commented 5 days ago

As a test, I added MB_SYSTEMMODAL to the flags here:

https://github.com/PolyMeilex/rfd/blob/6f9062ee533f931500f5aeeae82b1efbe8e26b30/src/backend/win_cid/message_dialog.rs#L65

which fixed the issue.

Would you be open for a PR that extends the API to allow setting this flag?

Reference: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messageboxw