473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Detect if Themes are enabled?

Using .NET 1.1, I need to be able to detect if Themes are enabled or
disabled, not for a specific application, but for the system as a whole (ie.
the current user). The reason I need to be able to do this is because of
this bug in MFC http://support.microsoft.com/?kbid=319740, which is used to
build a component I am in turn making use of. So, I need to detect if
Themes are running and if so, see if the correct version of uxtheme.dll is
installed, else disallow a certain operation.

Any hints?
May 16 '06 #1
6 1956

I solved this using the code below, I hope it's more or less correct:
Dim myVersion As Version =
OSFeature.Feature.GetVersionPresent(OSFeature.Them es)

If not myVersion Is Nothing Then

Return True

Else

Return False

End If
"Fred Hedges" <do******@spammuch.com> escribió en el mensaje
news:e4*******************@news.demon.co.uk...
Using .NET 1.1, I need to be able to detect if Themes are enabled or
disabled, not for a specific application, but for the system as a whole
(ie. the current user). The reason I need to be able to do this is
because of this bug in MFC http://support.microsoft.com/?kbid=319740,
which is used to build a component I am in turn making use of. So, I need
to detect if Themes are running and if so, see if the correct version of
uxtheme.dll is installed, else disallow a certain operation.

Any hints?

May 16 '06 #2
Fred,

That is a good method.

Ken
-----------------

"Fred Hedges" wrote:

I solved this using the code below, I hope it's more or less correct:
Dim myVersion As Version =
OSFeature.Feature.GetVersionPresent(OSFeature.Them es)

If not myVersion Is Nothing Then

Return True

Else

Return False

End If
"Fred Hedges" <do******@spammuch.com> escribió en el mensaje
news:e4*******************@news.demon.co.uk...
Using .NET 1.1, I need to be able to detect if Themes are enabled or
disabled, not for a specific application, but for the system as a whole
(ie. the current user). The reason I need to be able to do this is
because of this bug in MFC http://support.microsoft.com/?kbid=319740,
which is used to build a component I am in turn making use of. So, I need
to detect if Themes are running and if so, see if the correct version of
uxtheme.dll is installed, else disallow a certain operation.

Any hints?


May 16 '06 #3
Hi Fred,

You can use UxTheme's IsThemActive() API, available in Windows XP (NT 5.1)
and later.

<System.Runtime.InteropServices.DllImport("UxTheme ")> _
Public Shared Function IsThemeActive() as Boolean
End Function

After the P/Invoke function is defined in the appropriate scope, you can
call it provided that the Operating System's version is at least Windows XP:

Dim fThemesActive As Boolean = False
If Environment.OSVersion.Version >= New Version(5, 1) Then
fThemesActive = IsThemeActive()
End If

--
Stanimir Stoyanov
www.stoyanoff.info
"Fred Hedges" wrote:
Using .NET 1.1, I need to be able to detect if Themes are enabled or
disabled, not for a specific application, but for the system as a whole (ie.
the current user). The reason I need to be able to do this is because of
this bug in MFC http://support.microsoft.com/?kbid=319740, which is used to
build a component I am in turn making use of. So, I need to detect if
Themes are running and if so, see if the correct version of uxtheme.dll is
installed, else disallow a certain operation.

Any hints?

May 16 '06 #4
To continue this conversation with myself, the above didn't work, because it
checks to see if the feature is present, not whether or not it is currently
switched on/off. I am still looking for a way to see if the user is using a
Theme (other than the stock "Classic Windows", which isn't really a Theme,
it's more the way things were before MS botched up it's themes
implementation).
"Fred Hedges" <do******@spammuch.com> escribió en el mensaje
news:e4*******************@news.demon.co.uk...

I solved this using the code below, I hope it's more or less correct:
Dim myVersion As Version =
OSFeature.Feature.GetVersionPresent(OSFeature.Them es)

If not myVersion Is Nothing Then

Return True

Else

Return False

End If
"Fred Hedges" <do******@spammuch.com> escribió en el mensaje
news:e4*******************@news.demon.co.uk...
Using .NET 1.1, I need to be able to detect if Themes are enabled or
disabled, not for a specific application, but for the system as a whole
(ie. the current user). The reason I need to be able to do this is
because of this bug in MFC http://support.microsoft.com/?kbid=319740,
which is used to build a component I am in turn making use of. So, I
need to detect if Themes are running and if so, see if the correct
version of uxtheme.dll is installed, else disallow a certain operation.

Any hints?


May 16 '06 #5

Thats the one! Thanks.

Public Declare Auto Function IsThemeActive Lib "uxtheme.dll" () As Boolean


"Stanimir Stoyanov" <admin{at}stoyanoff{dot}info> escribió en el mensaje
news:27**********************************@microsof t.com...
Hi Fred,

You can use UxTheme's IsThemActive() API, available in Windows XP (NT 5.1)
and later.

<System.Runtime.InteropServices.DllImport("UxTheme ")> _
Public Shared Function IsThemeActive() as Boolean
End Function

After the P/Invoke function is defined in the appropriate scope, you can
call it provided that the Operating System's version is at least Windows
XP:

Dim fThemesActive As Boolean = False
If Environment.OSVersion.Version >= New Version(5, 1) Then
fThemesActive = IsThemeActive()
End If

--
Stanimir Stoyanov
www.stoyanoff.info
"Fred Hedges" wrote:
Using .NET 1.1, I need to be able to detect if Themes are enabled or
disabled, not for a specific application, but for the system as a whole
(ie.
the current user). The reason I need to be able to do this is because of
this bug in MFC http://support.microsoft.com/?kbid=319740, which is used
to
build a component I am in turn making use of. So, I need to detect if
Themes are running and if so, see if the correct version of uxtheme.dll
is
installed, else disallow a certain operation.

Any hints?

May 16 '06 #6
"Fred Hedges" <do******@spammuch.com> schrieb:
Public Declare Auto Function IsThemeActive Lib "uxtheme.dll" () As Boolean


Remove the 'Auto' keyword.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carl Mercier | last post by:
Hi, I'm trying to detect if XP themes are enabled or not in code. This not as easy as it seams, however. I thought Application.VisualStyleState would be of a lot of help, but unfortunately, it...
9
by: Agoston Bejo | last post by:
Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be...
6
by: NWx | last post by:
Hi, How can I detect is cookies are enabled or not in client browser? Thanks?
1
by: Dean Slindee | last post by:
Would like to use WindowsXP graphics themes (like shaded tab page in tab control), but am using Windows 2000 operating system. Using Visual Studio 2005 and .Net Framwork 2.0. Have the option...
6
by: Clinton Farleigh | last post by:
Hi, I was going to ask a question, but I think I've answered it so now I am going to rant about how crappy ASP.NET themes are instead. As I've indicated above, my problem today is with themes....
0
by: Don | last post by:
Can this be done? I have theming enabled and have two themes for my web site (hence two folders in the Themes). But I need the styles to be applied whilst developing in the IDE. I cannot see...
2
by: CK | last post by:
Hello All, I am trying to extend the default asp:ImageButton to include an image for an enabled state and a second image for a disabled state. I currently did this by extending the ImageButton...
1
stepterr
by: stepterr | last post by:
Hi All, Does anyone know if it is possible to detect if a user has SSL enabled in their browser? I have a login page that is https but if the user does not have SSL enabled it of course just gives...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.