Jump to content

Another "Disabling Visual Effects" Post


Recommended Posts

Posted

Hello everybody! I've been searching all day for an answer to this. MSFN has come the closest to answering the question, but like many people here, I still have not been successfull in getting it to work.

The problem is with the Visual Effects in XP. We have an application which records the screens of call representatives, and since moving to XP we've seen performance decrease as a result of the added effects. Currently we're telling their managers to have them manually disable all of these settings, but obviously it would be far better if we could automate this.

And this is where I come in. I've written a small script that will disable all of the visual effect settings using registry entries I've found numerous places on MSFN. But like everybody else, these settings are not applied even after a reboot. If you go into the Visual Effects settings you can see that they are all disabled, but for whatever reason, XP is not recognizing it, and all menus continue to fade etc.

There's obviously something else that must take place. Often, when you apply new themes or Visual Effects, XP presents a "Please Wait" screen while the settings are applied. If you're on a slower machine, this "Please Wait" screen will appear for a longer time and the screen will slowly turn grey as it works. I'm curious as to what is happening during this time. Is XP somehow re-loading it's shell? Is there an API call or something I could use to invoke this functionality after applying the registry settings? I've noticed that restarting the Themes service will reload the theme, but not the Visual Effects (also confirmed here on MSFN).

According to one post in MSFN, rebooting twice should help. In another, setting the "FX" property to 3 (custom) and everything else to 0 claimed to work, but it didn't for me. In fact, the "3" part did, but even with everything else at 0 all visual effects remained checked.

I've exhausted all my resources looking into this. I'd be eternally grateful if anybody can help out.


Posted

just because I'm curious....

have you tried creating a custom visual style that contains all the settings you want?

You will need a custom uxtheme.dll file however, which I'm sure might be against company policy, but it might get you on the right track to finding the correct solution

Posted

I have not tried this, and it is a good suggestion. It's VERY likely to be against company policy, but we may be able to work with it depending on the details.

I'll begin searching for information on uxtheme.dll, how to use it to create a custom visual style. I've not done this before.

Your reply is appreciated. Thanks Alanoll. I'm beginning to like the "mood" of this forum. Everybody seems friendly and willing to help out. Hard to find anymore.

Posted

I have figured it out and thought I'd share. This works perfectly. I've included all the VB6 code and instructions of how to use it. :)

Dreate a new module (no form is needed). Set the default startup item to Sub_Main().

Option Explicit
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As Long

Private Declare Function SystemParametersInfoByLong Lib "user32" Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
ByVal lpvParam As Long, _
ByVal fuWinIni As Long) As Long

Private Enum enSystemParametersInfo
'    SPI_NOMESSAGE = 0 '\\ To cope with Win95/WinNT differences!
'    SPI_GETBEEP = 1
'    SPI_SETBEEP = 2
'    SPI_GETMOUSE = 3
'    SPI_SETMOUSE = 4
'    SPI_GETBORDER = 5
'    SPI_SETBORDER = 6
'    SPI_GETKEYBOARDSPEED = 10
'    SPI_SETKEYBOARDSPEED = 11
'    SPI_LANGDRIVER = 12
'    SPI_ICONHORIZONTALSPACING = 13
'    SPI_GETSCREENSAVETIMEOUT = 14
'    SPI_SETSCREENSAVETIMEOUT = 15
'    SPI_GETSCREENSAVEACTIVE = 16
'    SPI_SETSCREENSAVEACTIVE = 17
'    SPI_GETGRIDGRANULARITY = 18
'    SPI_SETGRIDGRANULARITY = 19
'    SPI_SETDESKPATTERN = 21
'    SPI_GETKEYBOARDDELAY = 22
'    SPI_SETKEYBOARDDELAY = 23
'    SPI_ICONVERTICALSPACING = 24
'    SPI_GETICONTITLEWRAP = 25
'    SPI_SETICONTITLEWRAP = 26
'    SPI_GETMENUDROPALIGNMENT = 27
'    SPI_SETMENUDROPALIGNMENT = 28
'    SPI_SETDOUBLECLKWIDTH = 29
'    SPI_SETDOUBLECLKHEIGHT = 30
'    SPI_GETICONTITLELOGFONT = 31
'    SPI_SETDOUBLECLICKTIME = 32
'    SPI_SETMOUSEBUTTONSWAP = 33
'    SPI_SETICONTITLELOGFONT = 34
'    SPI_GETFASTTASKSWITCH = 35
'    SPI_SETFASTTASKSWITCH = 36
'    SPI_GETDRAGFULLWINDOWS = 38
'    SPI_GETNONCLIENTMETRICS = 41
'    SPI_SETNONCLIENTMETRICS = 42
'    SPI_GETMINIMIZEDMETRICS = 43
'    SPI_SETMINIMIZEDMETRICS = 44
'    SPI_GETICONMETRICS = 45
'    SPI_SETICONMETRICS = 46
'    SPI_SETWORKAREA = 47
'    SPI_GETWORKAREA = 48
'    SPI_SETPENWINDOWS = 49
'    SPI_GETHIGHCONTRAST = 66
'    SPI_SETHIGHCONTRAST = 67
'    SPI_GETKEYBOARDPREF = 68
'    SPI_SETKEYBOARDPREF = 69
'    SPI_GETSCREENREADER = 70
'    SPI_SETSCREENREADER = 71
'    SPI_GETANIMATION = 72
'    SPI_SETANIMATION = 73
'    SPI_GETFONTSMOOTHING = 74
'    SPI_SETFONTSMOOTHING = 75
'    SPI_SETDRAGWIDTH = 76
'    SPI_SETDRAGHEIGHT = 77
'    SPI_SETHANDHELD = 78
'    SPI_GETLOWPOWERTIMEOUT = 79
'    SPI_GETPOWEROFFTIMEOUT = 80
'    SPI_SETLOWPOWERTIMEOUT = 81
'    SPI_SETPOWEROFFTIMEOUT = 82
'    SPI_GETLOWPOWERACTIVE = 83
'    SPI_GETPOWEROFFACTIVE = 84
'    SPI_SETLOWPOWERACTIVE = 85
'    SPI_SETPOWEROFFACTIVE = 86
'    SPI_SETCURSORS = 87
'    SPI_SETICONS = 88
'    SPI_GETDEFAULTINPUTLANG = 89
'    SPI_SETDEFAULTINPUTLANG = 90
'    SPI_SETLANGTOGGLE = 91
'    SPI_GETWINDOWSEXTENSION = 92
'    SPI_SETMOUSETRAILS = 93
'    SPI_GETMOUSETRAILS = 94
'    SPI_SETSCREENSAVERRUNNING = 97
'    SPI_GETFILTERKEYS = 50
'    SPI_SETFILTERKEYS = 51
'    SPI_GETTOGGLEKEYS = 52
'    SPI_SETTOGGLEKEYS = 53
'    SPI_GETMOUSEKEYS = 54
'    SPI_SETMOUSEKEYS = 55
'    SPI_GETSHOWSOUNDS = 56
'    SPI_SETSHOWSOUNDS = 57
'    SPI_GETSTICKYKEYS = 58
'    SPI_SETSTICKYKEYS = 59
'    SPI_GETACCESSTIMEOUT = 60
'    SPI_SETACCESSTIMEOUT = 61
'    SPI_GETSERIALKEYS = 62
'    SPI_SETSERIALKEYS = 63
'    SPI_GETSOUNDSENTRY = 64
'    SPI_SETSOUNDSENTRY = 65
'    SPI_GETMOUSEHOVERWIDTH = 98
'    SPI_SETMOUSEHOVERWIDTH = 99
'    SPI_GETMOUSEHOVERHEIGHT = 100
'    SPI_SETMOUSEHOVERHEIGHT = 101
'    SPI_GETMOUSEHOVERTIME = 102
'    SPI_SETMOUSEHOVERTIME = 103
'    SPI_GETWHEELSCROLLLINES = 104
'    SPI_SETWHEELSCROLLLINES = 105
'    SPI_GETSHOWIMEUI = 110
'    SPI_SETSHOWIMEUI = 111
'    SPI_GETMOUSESPEED = 112
'    SPI_SETMOUSESPEED = 113
'    SPI_GETSCREENSAVERRUNNING = 114
'    SPI_GETACTIVEWINDOWTRACKING = &H1000
'    SPI_SETACTIVEWINDOWTRACKING = &H1001
'    SPI_GETMENUANIMATION = &H1002
'    SPI_SETMENUANIMATION = &H1003
'    SPI_GETCOMBOBOXANIMATION = &H1004
'    SPI_SETCOMBOBOXANIMATION = &H1005
'    SPI_GETLISTBOXSMOOTHSCROLLING = &H1006
'    SPI_SETLISTBOXSMOOTHSCROLLING = &H1007
'    SPI_GETGRADIENTCAPTIONS = &H1008
'    SPI_SETGRADIENTCAPTIONS = &H1009
'    SPI_GETMENUUNDERLINES = &H100A
'    SPI_SETMENUUNDERLINES = &H100B
'    SPI_GETACTIVEWNDTRKZORDER = &H100C
'    SPI_SETACTIVEWNDTRKZORDER = &H100D
'    SPI_GETHOTTRACKING = &H100E
'    SPI_SETHOTTRACKING = &H100F
'    SPI_GETFOREGROUNDLOCKTIMEOUT = &H2000
'    SPI_SETFOREGROUNDLOCKTIMEOUT = &H2001
'    SPI_GETACTIVEWNDTRKTIMEOUT = &H2002
'    SPI_SETACTIVEWNDTRKTIMEOUT = &H2003
'    SPI_GETFOREGROUNDFLASHCOUNT = &H2004
'    SPI_SETFOREGROUNDFLASHCOUNT = &H2005
   SPI_SETDESKWALLPAPER = 20
   SPIF_UPDATEINIFILE = &H1
   SPIF_SENDWININICHANGE = &H2
   SPIF_SENDCHANGE = SPIF_SENDWININICHANGE
   SPI_GETUIEFFECTS = &H103E&
   SPI_SETUIEFFECTS = &H103F&
   SPI_SETDRAGFULLWINDOWS = 37
End Enum
Private Sub Main()
   Dim lResult As Long
   Dim intCtr As Integer
   Dim intDesktop As Integer
   Dim intVE As Integer
   Dim intSWC As Integer
   Dim strParameters As String
   Dim strBlissPath As String
   Dim arrParameters() As String
   Dim intNumParameters As Integer
   strParameters = Command
   intDesktop = -1
   intVE = -1
   intSWC = -1
   intNumParameters = ParseString(Trim(strParameters), "/", arrParameters())
   For intCtr = LBound(arrParameters) To UBound(arrParameters) Step 1
       If InStr(1, UCase(arrParameters(intCtr)), "DESKTOP") Then
           intDesktop = Val(Right(Trim(arrParameters(intCtr)), 1))
           WriteToLog (Chr(34) & "Desktop" & Chr(34) & " parameter found.  Value = " & intDesktop)
       End If
       If InStr(1, UCase(arrParameters(intCtr)), "VE") Then
           intVE = Val(Right(Trim(arrParameters(intCtr)), 1))
           WriteToLog (Chr(34) & "VE" & Chr(34) & " parameter found.  Value = " & intVE)
       End If
       If InStr(1, UCase(arrParameters(intCtr)), "SWC") Then
           intSWC = Val(Right(Trim(arrParameters(intCtr)), 1))
           WriteToLog (Chr(34) & "SWC" & Chr(34) & " parameter found.  Value = " & intSWC)
       End If
   Next
   If intDesktop = -1 And intVE = -1 And intSWC = -1 Then
       WriteToLog ("No parameters found.  Applying all performance enhancement settings.")
       intDesktop = 0
       intVE = 0
       intSWC = 0
   End If
   If intDesktop = 0 Then
       WriteToLog ("Removing wallpaper.")
       lResult = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal "", SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
       If lResult <> 0 Then
           WriteToLog ("Removing wallpaper successful.")
       Else
           WriteToLog ("Removing wallpaper failed.")
       End If
   End If
   If intDesktop = 1 Then
       strBlissPath = Environ("WINDIR") & "\Web\Wallpaper\Bliss.bmp"
       WriteToLog ("Applying default wallpaper (Bliss.bmp).")
       lResult = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal strBlissPath, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
       If lResult <> 0 Then
           WriteToLog ("Applying wallpaper successful.")
       Else
           WriteToLog ("Applying wallpaper failed.")
       End If
   End If
   If intVE = 0 Then
       WriteToLog ("Disabling all visual effects.")
       lResult = SystemParametersInfoByLong(SPI_SETUIEFFECTS, 0, 0, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
       If lResult <> 0 Then
           WriteToLog ("Disabling visual effects successful.")
       Else
           WriteToLog ("Disabling visual effects failed.")
       End If
   End If
   If intVE = 1 Then
       WriteToLog ("Enabling visual effects.")
       lResult = SystemParametersInfoByLong(SPI_SETUIEFFECTS, 0, 1, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
       If lResult <> 0 Then
           WriteToLog ("Enabling visual effects successful.")
       Else
           WriteToLog ("Enabling visual effects failed.")
       End If
   End If
   If intSWC = 0 Then
       WriteToLog ("Disabling " & Chr(34) & "Show Windows Contents While Dragging" & Chr(34))
       lResult = SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0, vbNullString, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
       If lResult <> 0 Then
           WriteToLog ("Disabling " & Chr(34) & "Show Windows Contents While Dragging" & Chr(34) & " successful.")
       Else
           WriteToLog ("Disabling " & Chr(34) & "Show Windows Contents While Dragging" & Chr(34) & " failed.")
       End If
   End If
   If intSWC = 1 Then
       WriteToLog ("Enabling " & Chr(34) & "Show Windows Contents While Dragging" & Chr(34))
       lResult = SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 1, vbNullString, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
       If lResult <> 0 Then
           WriteToLog ("Enabling " & Chr(34) & "Show Windows Contents While Dragging" & Chr(34) & " successful.")
       Else
           WriteToLog ("Enabling " & Chr(34) & "Show Windows Contents While Dragging" & Chr(34) & " failed.")
       End If
   End If
   End
errorhandler:
   WriteToLog ("Error: " & Err.Number & " occurred.  Description: " & Err.Description)
End Sub
Private Sub WriteToLog(ByVal strMessage As String)
   Open App.Path & "\ImprovePerformance.log" For Append As #100
       Print #100, Now() & ": " & strMessage
   Close #100
End Sub
Private Function ParseString(vstrKey As String, vstrDelimiter As String, ByRef rstrRetArr() As String) As Integer
   Dim mintPos1 As Integer
   Dim mintPos2 As Integer
   Dim mintLen1 As Integer
   Dim mintLen2 As Integer
   Dim mintCount As Integer
       On Error GoTo Errhnd
       mintLen1 = Len(vstrKey)
       mintLen2 = Len(vstrDelimiter)
       mintPos1 = 1
       mintPos2 = InStr(mintPos1, vstrKey, _
                        vstrDelimiter, vbTextCompare)
       mintCount = 0
       ParseString = mintCount
       If mintPos2 = 0 Then
           mintCount = mintCount + 1
           ReDim rstrRetArr(mintCount) As String
           rstrRetArr(mintCount - 1) = Trim(vstrKey)
           ParseString = mintCount
           Exit Function
       End If
       If mintPos2 = 1 Then
           mintPos1 = mintPos2 + mintLen2
           mintPos2 = InStr(mintPos1, vstrKey, _
                            vstrDelimiter, vbTextCompare)
       End If
       While (mintPos2 > 0)
           mintCount = mintCount + 1
           ReDim Preserve rstrRetArr(mintCount) As String
           rstrRetArr(mintCount - 1) = Trim(Mid(vstrKey, mintPos1, mintPos2 - mintPos1))
           ParseString = mintCount
           mintPos1 = mintPos2 + mintLen2
           If mintPos1 <= mintLen1 Then
               mintPos2 = InStr(mintPos1, vstrKey, _
                                vstrDelimiter, vbTextCompare)
           Else
               mintPos2 = 0
           End If
       Wend
       If mintPos1 <= mintLen1 Then
           mintCount = mintCount + 1
           ReDim Preserve rstrRetArr(mintCount) As String
           rstrRetArr(mintCount - 1) = Trim(Mid(vstrKey, mintPos1, (mintLen1 - mintPos1) + 1))
           ParseString = mintCount
       End If
       Exit Function
Errhnd:
       ParseString = 0
End Function

This will allow you to enable/disable all visual effects on an XP workstation. These settings are system-wide and should remain after reboots. Here's how to use it.

Double clicking on it disables all visual effects AND removes the desktop wallpaper.

If this is not desirable, you can customize what it changes using parameters passed from the command line:

Parameters:

[/desktop:0 or 1] --- 0 disables the wallpaper. 1 applies the default wallpaper (Bliss.bmp)

[/swc:0 or 1]---0 disables "Show Windows Contents While Dragging". 1 enables it.

[/ve:0 or 1] ---0 disables all visual effects. 1 enables them.

Examples:

C:\ImprovePerformance.exe /swc:1 /desktop:0 /ve:0

-This will enable "Show Windows Contents", disable the desktop wallpaper, and disable all visual effects.

C:\ImprovePerformance.exe

-This will disable everything, same as double clicking it.

The app will also produce a log file, named "ImprovePerformance.log" located in the same directory as the .exe. Here's a sample of this log:

3/26/2004 9:25:24 AM: "Desktop" parameter found. Value = 0

3/26/2004 9:25:24 AM: Removing wallpaper.

3/26/2004 9:25:25 AM: Removing wallpaper successful.

3/26/2004 9:30:39 AM: No parameters found. Applying all performance enhancement settings.

3/26/2004 9:30:39 AM: Removing wallpaper.

3/26/2004 9:30:40 AM: Removing wallpaper successful.

3/26/2004 9:30:40 AM: Disabling all visual effects.

3/26/2004 9:30:40 AM: Disabling visual effects successful.

3/26/2004 9:30:40 AM: Disabling "Show Windows Contents While Dragging"

3/26/2004 9:30:40 AM: Disabling "Show Windows Contents While Dragging" successful.

3/26/2004 9:30:53 AM: "Desktop" parameter found. Value = 1

3/26/2004 9:30:53 AM: "VE" parameter found. Value = 0

3/26/2004 9:30:53 AM: Applying default wallpaper (Bliss.bmp).

3/26/2004 9:30:54 AM: Applying wallpaper successful.

3/26/2004 9:30:54 AM: Disabling all visual effects.

3/26/2004 9:30:54 AM: Disabling visual effects successful.

3/26/2004 9:31:02 AM: "Desktop" parameter found. Value = 0

3/26/2004 9:31:02 AM: "VE" parameter found. Value = 1

3/26/2004 9:31:02 AM: Removing wallpaper.

3/26/2004 9:31:02 AM: Removing wallpaper successful.

3/26/2004 9:31:02 AM: Enabling visual effects.

3/26/2004 9:31:03 AM: Enabling visual effects successful.

3/26/2004 9:31:09 AM: "VE" parameter found. Value = 1

3/26/2004 9:31:09 AM: Enabling visual effects.

3/26/2004 9:31:09 AM: Enabling visual effects successful.

Enjoy, and let me know if you have any problems/questions.

  • 4 years later...
Posted

hi atreyu

i tried doing what u said by making a .exe in VB but still cant make it could u please help me with it.

mu email id is irshadqureshi@rediffmail.com

thanx in advance

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...