如何恢复企业 Windows 7 主题

发布于 2024-10-08 14:39:36 字数 685 浏览 0 评论 0原文

作为我圣诞节周的副项目,我想我应该创建一个可以从 Windows 启动文件夹运行的快速控制台应用程序。

该应用程序将删除一些不需要的全局企业桌面图标(我喜欢运行干净的桌面 - 这常见吗?)并将 Windows 7 主题重置为我可爱的 ​​Visual Studio 2010 图形。

我已经阅读了为什么不应该为用户以语法方式完成此操作的原因,但我觉得这种情况有所不同,因为每天早上我都会手动删除图标并重置主题(政策并没有阻止这一点 - 只是每天早上重新应用它)所以我认为这个小项目从长远来看可以节省我的时间。

我正在删除图标,但我正在努力设置我的主题:

Dim key As RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Themes", True)

key.SetValue("CurrentTheme", "C:\Users\myprofile\AppData\Local\Microsoft\Windows\Themes\VS2010.theme")

key.Close()

这是正确设置注册表项但不应用它。任何有关如何进行这项工作或替代方案的建议将不胜感激。最终我可能会尝试一个简单的壁纸集,但如果可能的话我想使用主题!

谢谢

As my Christmas week side-project I thought I'd knock up a quick console app that I can run from the windows Start-up folder.

The application is going to delete some unwanted Global Corporate Desktop Icons (I like to run a clean desktop - is this common?) and Reset the Windows 7 Theme to my lovely Visual Studio 2010 graphics.

I have read the reasons why this shouldn't be done pro grammatically for the user but I feel this case is different as every morning I am manually deleting the icons and resetting the theme (policy is not stopping this - just reapplying it every morning) so I though this little side project could save me time in the long term.

I am deleting the Icons OK but I am struggling to set my theme ala:

Dim key As RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Themes", True)

key.SetValue("CurrentTheme", "C:\Users\myprofile\AppData\Local\Microsoft\Windows\Themes\VS2010.theme")

key.Close()

This is setting the registry key correctly but not applying it. Any suggestions as to how to make this work or alternatives would be appreciated. Ultimately I may try a simple Wallpaper Set but I would like to use the theme if possible!

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

开始看清了 2024-10-15 14:39:36

您必须通过 P/Invoke 来进行更改。您需要使用 SetSystemVisualStyle方法。

<DllImport("UxTheme.DLL", BestFitMapping:=False, CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Unicode, EntryPoint:="#65")> _
Shared Function SetSystemVisualStyle(ByVal pszFilename As String, ByVal pszColor As String, ByVal pszSize As String, ByVal dwReserved As Integer) As Integer
End Function

SetSystemVisualStyle("C:\WINDOWS\resources\Themes\Luna\Luna.msstyles", "Metallic", "NormalSize", 0)

PInvoke.net 现在给我带来了问题,因此您可能需要使用 缓存页面

You'll have to P/Invoke to make that change. You'll need to use the SetSystemVisualStyle method.

<DllImport("UxTheme.DLL", BestFitMapping:=False, CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Unicode, EntryPoint:="#65")> _
Shared Function SetSystemVisualStyle(ByVal pszFilename As String, ByVal pszColor As String, ByVal pszSize As String, ByVal dwReserved As Integer) As Integer
End Function

SetSystemVisualStyle("C:\WINDOWS\resources\Themes\Luna\Luna.msstyles", "Metallic", "NormalSize", 0)

PInvoke.net is giving me problems right now so you might need to used the cached page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文