Hi pnp,
I never tried before. But you should look into uxtheme.dll. For more info how to call them, check this.
http://pinvoke.net
To get what is the current UI, at least i know how to do a bit.. ee.. actually learn it from codeproject.
I believe if you can do it if you know the right way to call it. Below is an example of getting what are the styles using for the current windows.
The themes are stored in the registery part of windows.
//references:
http://www.thecodeproject.com/csharp/xptheme.asp
using System;
using System.Runtime. InteropServices ;
using Microsoft.Win32 ;
namespace TestVisualStyle s
{
class CheckThemeClass
{
[STAThread]
static void Main(string[] args)
{
Console.WriteLi ne("Current Windows Theme = {0}", CurrentTheme()) ;
Console.WriteLi ne("Windows Theme Active = {0}", IsThemeActive() );
Console.WriteLi ne("Applicatio n Theme Active = {0}", IsAppThemed());
Console.ReadLin e();
}
public enum Themes
{
WindowsClassic,
XPBlue,
XPGreen,
XPSilver
}
public static Themes CurrentTheme()
{
RegistryKey key =
Registry.Curren tUser.OpenSubKe y(
@"Software\Micr osoft\Windows\C urrentVersion\T hemeManager");
if (key != null)
{
if ("1" == (string) key.GetValue("T hemeActive"))
{
string s = (string) key.GetValue("C olorName");
if (s != null)
{
if (String.Compare (s, "NormalColo r", true) == 0)
return Themes.XPBlue;
if (String.Compare (s, "HomeStead" , true) == 0)
return Themes.XPGreen;
if (String.Compare (s, "Metallic", true) == 0)
return Themes.XPSilver ;
}
}
}
return Themes.WindowsC lassic;
}
[DllImport("uxth eme.dll", SetLastError=tr ue)]
public static extern bool IsThemeActive() ;
[DllImport("uxth eme.dll", SetLastError=tr ue)]
public static extern bool IsAppThemed();
}
}
Hope it helps.
--
Regards,
Chua Wen Ching :)
"pnp" wrote:
Thanks Chua on your so soon reply, but I wondered if I could use the windows
theme files...
"Chua Wen Ching" <ch************ @nospam.hotmail .com> wrote in message
news:1D******** *************** ***********@mic rosoft.com... Hi pnp,
I believe you mean by skins / style.
Well you can write something that can control which skins you one. One
good example of a .net skin / styles you can use.
http://www.dotnetmagic.com/
I believe there is more.
Good Luck. Correct me if i am wrong.
--
Regards,
Chua Wen Ching :)
"pnp" wrote:
Hi all,
Could I use an external dll (that windows also use for it's themes) from which my application could load it's graphics at runtime? Basically I wan't to be able to select the styles for my application without changing the
windows general appearance.
Thanks,
Peter.