473,769 Members | 7,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1973

I solved this using the code below, I hope it's more or less correct:
Dim myVersion As Version =
OSFeature.Featu re.GetVersionPr esent(OSFeature .Themes)

If not myVersion Is Nothing Then

Return True

Else

Return False

End If
"Fred Hedges" <do******@spamm uch.com> escribió en el mensaje
news:e4******** ***********@new s.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.Featu re.GetVersionPr esent(OSFeature .Themes)

If not myVersion Is Nothing Then

Return True

Else

Return False

End If
"Fred Hedges" <do******@spamm uch.com> escribió en el mensaje
news:e4******** ***********@new s.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 .InteropService s.DllImport("Ux Theme")> _
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.OSV ersion.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******@spamm uch.com> escribió en el mensaje
news:e4******** ***********@new s.demon.co.uk.. .

I solved this using the code below, I hope it's more or less correct:
Dim myVersion As Version =
OSFeature.Featu re.GetVersionPr esent(OSFeature .Themes)

If not myVersion Is Nothing Then

Return True

Else

Return False

End If
"Fred Hedges" <do******@spamm uch.com> escribió en el mensaje
news:e4******** ***********@new s.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.dl l" () As Boolean


"Stanimir Stoyanov" <admin{at}stoya noff{dot}info> escribió en el mensaje
news:27******** *************** ***********@mic rosoft.com...
Hi Fred,

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

<System.Runtime .InteropService s.DllImport("Ux Theme")> _
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.OSV ersion.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******@spamm uch.com> schrieb:
Public Declare Auto Function IsThemeActive Lib "uxtheme.dl l" () 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
950
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 was not. Basically, I need something similar to this: If LegacyOS Then 'W2K, W98, WME return False
9
7860
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 a very basic functionality, so I am reluctant to believe that there's no way to simply test it in a server-side script. Anyone? Thx, Agoston
6
2716
by: NWx | last post by:
Hi, How can I detect is cookies are enabled or not in client browser? Thanks?
1
1149
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 "Enable XP visual styles" checked in the Project's Application tab. Following code was placed in the frmMain_Load event, but still no XP themes. What else must be done? 'use WindowsXP themes
6
2494
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. Per microsoft "Only one theme can be applied to each page. You cannot apply multiple themes to a page, unlike style sheets where multiple style sheets can be applied."
0
1289
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 the styles (styles not applied to the HTML) in the page unless and untill I set the styleSheetTheme attribute in the page directive. I.e. if I set the styleSheetTheme in the web.config, this doesn't make any difference in the IDE, but is applied...
2
2457
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 class in a custom control, creating a property for each of these images (EnabledImageUrl, DisabledImageUrl) and then overrode the Enabled property to change base.ImageUrl respectively. I am also trying to use Themes with this web site. The problem...
1
1970
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 them a page cannot be displayed message. What I would like to do is verify that they have it enabled, if they do not, then send them to another page that would walk them through how to enable it. I'm already doing this to verify their browser, if...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.