Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

SetSystemVisualStyle (uxtheme)
 
.

Epic Andrew is Stupid

Summary
Changes System Visual Style

C# Signature:

[DllImport("UxTheme.Dll", EntryPoint = "#65", CharSet = CharSet.Unicode)]
public static extern int SetSystemVisualStyle(string pszFilename, string pszColor, string pszSize, int dwReserved);

VB Signature:

<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

User-Defined Types:

None.

Usage:

pszFilename

Filename of the .msstyle file containing the VisualStyle

pszColor

Name of the color scheme you want to use. It has to be valid for the visual style.

pszSize

Name of the size scheme you want to use. It has to be valid in the visual style.

Notes:

This is an useful functions that appeared in Windows XP SP2. You can use it for changing the curent Visual Style under Windows XP SP2.

Tips & Tricks:

This functions sets the Visual Style altmost instantaneously and in a persistant way (i.e. the visual style will still be there after a reset)

Sample Code C#:

// This will set your Visual Style to Luna
SetSystemVisualStyle(@"C:\WINDOWS\resources\Themes\Luna\Luna.msstyles", "Metallic", "NormalSize", 0);

Sample Code VB.NET:

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

Alternative Managed API:

Do you know one? Please contribute it!

Related Managed API:

The System.Windows.Forms.VisualStyles namespace allows rendering of various Visual Style elements, which sometimes can be cumbersome if you have alot of elements to work with or just want to keep the code to a minimal (or are on the design team and not the code team). Or you can get the freeware .NET component to place VisualStyleElement parts in the IDE forms designer using the VisualStyleRenderer .NET control. You can

get it at http://www.paradisim.net.

Documentation
This is an undocumented function

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions