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

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

Open
benma opened this issue Jul 1, 2024 · 4 comments

Comments

@benma
Copy link

benma commented Jul 1, 2024

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
Copy link
Author

benma commented Jul 1, 2024

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

flags: level | buttons,

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

@benma
Copy link
Author

benma commented Aug 27, 2024

ping @PolyMeilex

@PolyMeilex
Copy link
Owner

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

Sure, I would probably just make it the default and call it a day

@dtzxporter
Copy link
Contributor

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

Sure, I would probably just make it the default and call it a day

Making it default may have undesired consequences:

Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style.
Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate
attention (for example, running out of memory).
This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.

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

No branches or pull requests

3 participants