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

GetCurrentThemeName (uxtheme)
 
.
Summary

Get the name of the current theme in-use. Optionally, return the ColorScheme name and the Size name of the theme.

C# Signature:

[DllImport("uxtheme", ExactSpelling=true, CharSet=CharSet.Unicode)]
public extern static Int32 GetCurrentThemeName(StringBuilder stringThemeName, int lengthThemeName, StringBuilder stringColorName, int lengthColorName, StringBuilder stringSizeName, int lengthSizeName);

VB .NET Signature:

Declare Unicode Function GetCurrentThemeName Lib "uxtheme" (ByVal stringThemeName As StringBuilder, ByVal lengthThemeName As Integer, ByVal stringColorName As StringBuilder, ByVal lengthColorName As Integer, ByVal stringSizeName As StringBuilder, ByVal lengthSizeName As Integer) As Int32

User-Defined Types:

None.

Notes:

Originally the signature had the 3 StringBuilder parameters as out params, but that did not work. Once that was removed it worked.

Tips & Tricks:

When creating the StringBuilder variable, an initial size must be set otherwise an unmanaged exception is thrown

Sample Code:

    StringBuilder stringThemeName = new StringBuilder(260);
    StringBuilder stringColorName = new StringBuilder(260);
    StringBuilder stringSizeName = new StringBuilder(260);

    Int32 s = GetCurrentThemeName(
        stringThemeName, 260,
        stringColorName, 260,
        stringSizeName, 260);

    // if only one information is needed (e.g. the theme filename):
    StringBuilder sbFilename = new sbFilename(0x200);
    Int32 s = GetCurrentThemeName( sbFilename, 0x200, null, 0, null, 0);

Alternative Managed API:

TODO

Documentation

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