From: Jay Dee on
Hi all

A wile back I created a screen scraper that fired mouse and keyboard
events at a legacy dumb terminal style application to extract data.
Until recently it has worked a treat and saved many hours of playing
Copy/Paste.

Last week IT have started replacing our operating system with Windows
XP from Windows 2000 and I have encountered some problems with the
click position of the mouse over the legacy application.

The issue is cursed by the Windows XP default theme having a thicker
boarder around a window than the Windows 2000 default theme so the
mouse clicks end up a few pixels out and sometimes miss the buttons
they where intended to click.

My question

Is it possible to retrieve the name of the current desktop theme from
code so that I can update the application to click in a slightly
different place dependent on the desktop theme in use at the time?

So far all I have found close is to call;

Environment.OSVersion.VersionString

That tells me the operating system but not the current theme.

I was expecting to find the name of the current theme somewhere like a
registry value that I can call but I have had no look finding it.

Any help would be appreciated.

Many thanks

Jay Dee
From: not_a_commie on
I'm currently using this, which may help:

RegistryKey rk = null;
try
{
rk = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Plus!\
\Themes\\Current", RegistryKeyPermissionCheck.ReadSubTree);
if (rk != null)
{
string v = rk.GetValue("").ToString();
if (v.EndsWith("aero.theme", true, CultureInfo.InvariantCulture))
{
using (var stream = typeof
(Program).Assembly.GetManifestResourceStream
("MyProject.Resources.Aero.isl"))
Infragistics.Win.AppStyling.StyleManager.Load(stream, true,
"Aero");
}
}
}
catch (Exception ex)
{
// they may not have the key and that is fine
}
finally
{
if (rk != null)
rk.Close();
}
From: Jay Dee on
Brilliant thanks for the help