Skip to content

Conversation

@MGGSK
Copy link
Contributor

@MGGSK MGGSK commented Aug 14, 2025

Enables dark mode for message boxes.


int WINAPI SoftModalMessageBox_hook(MSGBOXDATA* lpData)
{
std::thread darkModeThread{SetDarkMode, lpData->lpszCaption, lpData->dwStyle};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a thread here has several potential problems:

  • The thread might run too late, which will cause the message box to become dark with a delay.
  • If message box creation fails, or if it's closed too fast, the thread might become stuck in an infinite loop.
  • What if there are several message boxes with the same title (e.g. "Error")?
  • The thread loop may cause 100% CPU usage for some time, which isn't so good, especially for laptops.

Have you considered an alternative solution, such as hooking CreateWindow or a similar API?

@marius-sucan
Copy link

marius-sucan commented Sep 13, 2025

the value of 45 and the font size 16, should be adjusted based on dpi.... it does not look correct on my system

@MGGSK
Copy link
Contributor Author

MGGSK commented Sep 13, 2025

the value of 45 and the font size 16, should be adjusted based on dpi.... it does not look correct on my system

I updated the mod to be dpi aware.

@marius-sucan
Copy link

marius-sucan commented Sep 13, 2025

Thank you very much ! It looks better, but... not yet there.

image

I think you should first get the height of the buttons and then draw the gray rect with btn_height+dpivalue(45)*2 (top/bottom margin).

For the font size, wouldn't it be better to use 0 ? It will then use the system font size. When the mod is applied, the font is smaller.

Best regards, Marius.

@MGGSK
Copy link
Contributor Author

MGGSK commented Sep 14, 2025

Thank you very much ! It looks better, but... not yet there.

image I think you should first get the height of the buttons and then draw the gray rect with btn_height+dpivalue(45)*2 (top/bottom margin).

For the font size, wouldn't it be better to use 0 ? It will then use the system font size. When the mod is applied, the font is smaller.

Best regards, Marius.

@marius-sucan I fixed the gray bar rendering. Also, on my system the default font size is smaller than what this mod uses.

@H5820121
Copy link

@MGGSK
Thank you very much!
In message boxes in Windows 11, there is a problem that the font size is smaller than usual, it would be great if on this occasion you could please give the option in the settings to increase the font size a little.

@MGGSK
Copy link
Contributor Author

MGGSK commented Sep 14, 2025

@MGGSK Thank you very much! In message boxes in Windows 11, there is a problem that the font size is smaller than usual, it would be great if on this occasion you could please give the option in the settings to increase the font size a little.

I don't see any difference in the font size on my pc, even on 300% dpi but I will add that font size option for users who want it.

@H5820121
Copy link

@MGGSK I have one laptop with WIN11 24H2 and it works fine there, and another laptop with WIN11 23H2 and it doesn't work there, maybe you have an idea why?

@MGGSK
Copy link
Contributor Author

MGGSK commented Sep 15, 2025

@MGGSK I have one laptop with WIN11 24H2 and it works fine there, and another laptop with WIN11 23H2 and it doesn't work there, maybe you have an idea why?

Can you share a screenshot of the issue?

@H5820121
Copy link

@MGGSK
There is no need to attach a screenshot, simply on this laptop all the message boxes remained the same as before activating this mod, except that there was created another strange thing that after I enabled this mod, when I restarted the laptop it took a long time for it to load all the startup applications, and when I canceled this mod and restarted this laptop again the startup applications were back to normal.

And I emphasize that on the second laptop with WIN11 24H2 the mod works fine.

@H5820121
Copy link

@MGGSK
Now I remember that I had the same issue there with the mod called "Message Box Fix". But the other mods like Dark mode context menus work fine there.
By the way, the Message Box Fix mod does not work with this mod, so I asked above that you give the option to increase the font size a little.

@MGGSK
Copy link
Contributor Author

MGGSK commented Sep 15, 2025

@MGGSK Now I remember that I had the same issue there with the mod called "Message Box Fix". But the other mods like Dark mode context menus work fine there. By the way, the Message Box Fix mod does not work with this mod, so I asked above that you give the option to increase the font size a little.

I added the font size option in the mod settings.

@H5820121
Copy link

@MGGSK
Thank you very much, works great!
(Now I have even more regret that your mod does not work on the second laptop and as above).

@H5820121
Copy link

@MGGSK
On this laptop, due to security constraints I am required to work offline, maybe this is related to the issue mentioned above?

@m417z
Copy link
Member

m417z commented Sep 16, 2025

Is the mod ready for submission? Are you planning to look at the thread usage (#2301 (comment))?

@MGGSK
Copy link
Contributor Author

MGGSK commented Sep 16, 2025

Is the mod ready for submission? Are you planning to look at the thread usage (#2301 (comment))?

I am currently working on removing the thread usage.

@H5820121
Copy link

H5820121 commented Sep 17, 2025

@MGGSK
I think it's enough to increase to 19, there's no need for 20:
image

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

Successfully merging this pull request may close these issues.

4 participants