开发者

How to revert Corporate Windows 7 Theme

开发者 https://www.devze.com 2023-01-31 09:08 出处:网络
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.

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 deskt开发者_如何学Goop - 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消