From 65138649e2ba5c8d1019acf1bb77837acb9d84ae Mon Sep 17 00:00:00 2001 From: Zacchary Dempsey-Plante Date: Wed, 19 Jul 2023 21:07:22 -0400 Subject: [PATCH 1/3] Change the default icon ID to match the Windows default, `32512`. This commit is identical to the one originally suggested for the `winres` project. --- lib.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib.rs b/lib.rs index 9148015..d525416 100644 --- a/lib.rs +++ b/lib.rs @@ -365,14 +365,18 @@ impl WindowsResource { self } - /// Add an icon with nameID `1`. + /// Add an icon with nameID `32512`. /// - /// This icon need to be in `ico` format. The filename can be absolute + /// This icon needs to be in `ico` format. The filename can be absolute /// or relative to the projects root. /// - /// Equivalent to `set_icon_with_id(path, "1")`. + /// Equivalent to `set_icon_with_id(path, "32512")`. + /// + /// Windows uses `32512` as the default icon ID. See + /// [here](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadicona) + /// for Windows docs demonstrating this. pub fn set_icon<'a>(&mut self, path: &'a str) -> &mut Self { - self.set_icon_with_id(path, "1") + self.set_icon_with_id(path, "32512") } /// Add an icon with the specified name ID. From b6366550da705a45b24f3ef4eb676cbfbbdf8dcb Mon Sep 17 00:00:00 2001 From: Zacchary Dempsey-Plante Date: Wed, 19 Jul 2023 21:08:31 -0400 Subject: [PATCH 2/3] Use a constant for `set_icon`: `DEFAULT_APPLICATION_ICON_ID`. --- lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib.rs b/lib.rs index d525416..05ec000 100644 --- a/lib.rs +++ b/lib.rs @@ -376,7 +376,9 @@ impl WindowsResource { /// [here](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadicona) /// for Windows docs demonstrating this. pub fn set_icon<'a>(&mut self, path: &'a str) -> &mut Self { - self.set_icon_with_id(path, "32512") + const DEFAULT_APPLICATION_ICON_ID: &str = "32512"; + + self.set_icon_with_id(path, DEFAULT_APPLICATION_ICON_ID) } /// Add an icon with the specified name ID. From 6eeadea830f92872859154a2a9aeb4f4e05f7015 Mon Sep 17 00:00:00 2001 From: Zacchary Dempsey-Plante Date: Wed, 19 Jul 2023 21:10:36 -0400 Subject: [PATCH 3/3] Update the MSDN link in the docs for `set_icon`, since Microsoft removed the pertinent section from the old link. --- lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.rs b/lib.rs index 05ec000..5892162 100644 --- a/lib.rs +++ b/lib.rs @@ -373,7 +373,7 @@ impl WindowsResource { /// Equivalent to `set_icon_with_id(path, "32512")`. /// /// Windows uses `32512` as the default icon ID. See - /// [here](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadicona) + /// [here](https://learn.microsoft.com/en-us/windows/win32/menurc/about-icons#icon-types) /// for Windows docs demonstrating this. pub fn set_icon<'a>(&mut self, path: &'a str) -> &mut Self { const DEFAULT_APPLICATION_ICON_ID: &str = "32512";