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

[Windows] runtime.MessageDialog frame icon missing windows #3684

Open
mstura opened this issue Aug 16, 2024 · 3 comments
Open

[Windows] runtime.MessageDialog frame icon missing windows #3684

mstura opened this issue Aug 16, 2024 · 3 comments
Labels
Bug Something isn't working Good First Issue Good for newcomers

Comments

@mstura
Copy link

mstura commented Aug 16, 2024

Description

When invoking runtime.MessageDialog the parent Icon is not propagated to the MessageDialog.
using the Icon field on runtime.MessageDialogOptions does not change this behavior.
I believe this might be due to the MB_SYSTEMMODAL flag which triggers the icon to be added but not match the main window icon.
This may also be inherent to MessageBoxW from the windows api when coupled with MB_SYSTEMMODAL flag, and the icon might only be possible to propagate using MessageBoxIndirectW (is not part of the bindings available by default to user32.dll)

To Reproduce

import ""github.com/wailsapp/wails/v2/pkg/runtime"

call runtime.MessageDialog(ctx, runtime.MessageDialogOptions{
Type: runtime.QuestionDialog,
Title: "any title",
Message: "any message",
} )

Expected behaviour

Expect the icon of the message box to match the parent window

Screenshots

image

Attempted Fixes

  • removing windows.MB_SYSTEMMODAL on line 194 in \internal\frontend\desktop\windows\dialog.go causes the icon to vanish entirely.
  • attempted to get the window handle manually and call make the syscall directly, I thought that perhaps the handle being passed to the message box wasn't correct.

System Details

# Wails
Version | v2.9.1

# System
┌─────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Pro                                                           |
| Version      | 2009 (Build: 22631)                                                      |
| ID           | 23H2                                                                     |
| Go Version   | go1.22.4                                                                 |
| Platform     | windows                                                                  |
| Architecture | amd64                                                                    |
| CPU          | 13th Gen Intel(R) Core(TM) i7-1365U                                      |
| GPU          | Intel(R) Iris(R) Xe Graphics (Intel Corporation) - Driver: 31.0.101.5333 |
| Memory       | 32GB                                                                     |
└─────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version        |
| WebView2   | N/A          | Installed | 127.0.2651.105 |
| Nodejs     | N/A          | Installed | 21.7.1         |
| npm        | N/A          | Installed | 10.5.0         |
| *upx       | N/A          | Available |                |
| *nsis      | N/A          | Available |                |
└─────────────── * - Optional Dependency ────────────────┘

# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

Additional context

No response

@mstura mstura added the Bug Something isn't working label Aug 16, 2024
@leaanthony
Copy link
Member

Thanks for opening this. Can confirm it's an issue.

@leaanthony leaanthony added the Good First Issue Good for newcomers label Aug 18, 2024
@mstura
Copy link
Author

mstura commented Aug 18, 2024

I'm not very proficient with the windows API but I have been searching for a possible solution, I'm under the impression that for windows the MessageBoxW Api isn't able to propagate the parent window icon unless I am missing something. And seems like it would require a programmatic creation of a dialog with CreateWindowExW and defining the proper template.
Perhaps someone with more knowledge of the windows API might have a better solution.

@aryandutt
Copy link

Can this issue be recreated considering the fact I am using a Macbook?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Good First Issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants