2

could you please help me?

What I need is a method to change the theme on a Windows machine without prompting the user with the display properties (personalization) window. The themechange should apply a .theme file from the c:\windows\resources\themes\ directory and NOT apply a new .msstyles. Method should only apply a .theme file. I have just been unable to find a way to apply the theme without causing the personalization window to appear. To emphasize, I dont want to solve this via scripts or macros. And also, closing the window via "sendkeys" is not an option, because it will still be seen momentarily.

Maybe there is a way out through WINAPI function or simple registry hack? Please, give me advice. Thank you.

Best regards

Phillip
  • 31
  • 1
  • 3
  • You can still use a script to pop up the theme window and position it off screen... – Daniel Aug 18 '11 at 23:32
  • But the window would still be visible for short time before it moves off the screen, right? The thing is, Windows uses desk.cpl to manage themes and I want it to start hidden. – Phillip Aug 19 '11 at 17:36
  • I'm not so sure. If at the moment you create the windows you move it on screen it might not show at all. – Daniel Aug 19 '11 at 18:05
  • Well, the task is quite sensitive when it comes to scripts. For example, I tried to use various commands in AutoIt script software, but they are all executed after the window initialization. Also, script first checks whether there is a window that we want to close/hide/minimize etc and then makes the action. This causes a "blinking window", something that I want to completely avoid. On the other hand, I managed to fully run blank and hidden Win32 Application Window that I created myself. Simply, I used WINAPI Winmain and put function ShowWindow(DWORD hWnd, int Parameter) after CreateWindowEx. – Phillip Aug 19 '11 at 19:23
  • My question is, if there is no other solution, how can I run WIN32 application "desk.cpl" via C/C++, make it hidden and then optionally send key "Ok" or "Apply" ? Hope you understand me. – Phillip Aug 19 '11 at 19:23
  • Applications should not go around changing the user's theme. Let the user keep their preferred theme. This sort of random "applications screwing with user settings" reduces user confidence and makes Windows look unstable. – Raymond Chen Jan 28 '12 at 17:27

2 Answers2

1
'Script name: yourtheme.vbs
'Object: Automate without command prompt the application of a Windows Theme by a VB script
'
'SCRIPT CONTENTS:
'Define Variables : 

    Set ShellApp = CreateObject("Shell.Application")
    Set WsShell = CreateObject("Wscript.Shell")


'
'Define path for your file theme (put it on a network share and don't forget to apply "read and execute" ACL for your Users)

    Theme = "typeyoursharepath\typeyourtheme.theme"
    Theme = """" + Theme + """"


'Open Display Properties Windows, Select your theme and apply with keep focus on Windows

    ShellApp.ControlPanelItem cstr("desk.cpl desk,@Themes /Action:OpenTheme /file:" & Theme)
    Wscript.Sleep 100
    WsShell.SendKeys "{ENTER}"
    While WsShell.AppActivate ("Display Properties") = TRUE
        WsShell.AppActivate "Display Properties"
    Wend

'In case of problem try to use a timeout value more important like "Wscript.Sleep 2000"
'END OF SCRIPT 

'NOTES:
'APPLIED SUCCESSFULLY ON WINDOWS XP AND WINDOWS SERVER 2003R2 X86   AND UNDER CITRIX XENAPP 4.6FP7 (OS: W2003R2X86 SP2) TO APPLY WINDOWS EMBEDDED THEME WITH BLUE BACKGROUND COLOR MORE LIGHT. 
'LOOKS GREAT ON CITRIX SESSION USER!
'INTEGRATED IN USER CONFIG GPO AT USER LOGON UNDER CITRIX XENAPP.
ronalchn
  • 12,225
  • 10
  • 51
  • 61
0

I don't think there is a native way to change Windows 7's (and windows 8's) theme silently, but you can try to use winaero theme switcher. you can read about and download it here.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71