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

Update nf-uxtheme-setwindowtheme.md #1936

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk-api-src/content/uxtheme/nf-uxtheme-setwindowtheme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ If this function succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>H
The theme manager retains the <i>pszSubAppName</i> and the <i>pszSubIdList</i> associations through the lifetime of the window, even if visual styles subsequently change. The window is sent a <a href="/windows/desktop/winmsg/wm-themechanged">WM_THEMECHANGED</a> message at the end of a <b>SetWindowTheme</b> call, so that the new visual style can be found and applied.


When <i>pszSubAppName</i> and <i>pszSubIdList</i> are <b>NULL</b>, the theme manager removes the previously applied associations. You can prevent visual styles from being applied to a specified window by specifying an empty string, (L" "), which does not match any section entries.
When <i>pszSubAppName</i> and <i>pszSubIdList</i> are <b>NULL</b>, the theme manager removes the previously applied associations. You can prevent visual styles from being applied to a specified window by specifying an empty string, (L""), which does not match any section entries.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this space is deliberate and we should correct the text instead. After a quick glance, it does appear uxtheme!SetWindowTheme behaves differently if "", " ", or nullptr is passed in.

Suggested change
When <i>pszSubAppName</i> and <i>pszSubIdList</i> are <b>NULL</b>, the theme manager removes the previously applied associations. You can prevent visual styles from being applied to a specified window by specifying an empty string, (L""), which does not match any section entries.
When <i>pszSubAppName</i> and <i>pszSubIdList</i> are <b>NULL</b>, the theme manager removes the previously applied associations. You can prevent visual styles from being applied to a specified window by specifying a string with a space, (L" "), which does not match any section entries.

Copy link
Contributor Author

@RatinCN RatinCN Jan 23, 2025

Choose a reason for hiding this comment

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

If pass L"", SetWindowTheme will assign L"$" to the property, which does not match anything.
And L" " does not match anything too, because no theme atom named " ".
SetWindowTheme compares income string with L"" explicitly, and uses L"$" replace it. So I think this should be the preset input for this function, rather than L" ".

Copy link
Contributor

Choose a reason for hiding this comment

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

The current implementation has the $ logic, but I wonder if that's supported downlevel with older releases. If so, then I agree!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know, Windows keeps this behavior since NT5. Imoh, the key is it compares L"", so this should be the preset input, whatever it replaces empty string by L"$" or L" " or others. Thanks for your attention : )

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me, feel free to mark as resolved.



#### Examples
Expand All @@ -97,4 +97,4 @@ The following example code gives a list-view control the appearance of a Windows
```cpp
SetWindowTheme(hwndList, L"Explorer", NULL);

```
```