Hi Stephan,
Thanks for sharing Alex's sample with us.
However it has no way to turn on/off the visual style on the runtime,
unless to redraw each control in the app manually to mimic the theme, but
that seems too complicated.
Regards
Gary Chang
Microsoft Online Partner Support
Get Secure! –
www.microsoft.com/security
This posting is provided "AS IS" with no warranties,and confers no rights.
--------------------
| From: "Stephan Schaem" <
[email protected]>
| References: <#
[email protected]>
<
[email protected]>
| Subject: Re: Emulating EnableVisualStyles()
| Date: Thu, 23 Oct 2003 01:13:06 -0700
| Lines: 72
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.vc
| NNTP-Posting-Host: adsl-64-167-237-174.dsl.scrm01.pacbell.net
64.167.237.174
| Path:
cpmsftngxa06.phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.
phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:29672
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| The function you outlined are global settings.
| So far, their is no real elegant solution to turn on off the style on the
fly
| but Alex Feinman showed me this solution (See his post below) to allow
this to be done at startup time.
|
| In short it manually load the manifest using the "Activation Context
Reference" API.
|
| Stephan
|
| To do this you use CreateActCtx function to create activation context
prior to any window-creating activity. The activation context
| will still require a manifest file, but whether to use it will be
decided programmatically.
|
| I've put together an MFC sample for you:
http://www.alexfeinman.com/download.asp?doc=ThemedApp.zip
|
| If you look inside InitInstance, you will find a call to ActivateContext
function, which performs the actual work.
|
| Naturally, due to the way theming is implemented, you will not be able to
switch theming support on the fly; at least not without
| recreating your windows.
| If you activate context prior to displaying a dialog, the dialog will be
created with theme support
|
|
| > Hi Stephan,
| >
| > Thanks for your post!
| >
| > You can find a bundle of unmanaged API functions in UxTheme.dll:
| > Visual Styles Reference
| >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/pla
| > tform/commctls/userex/refentry.asp
| >
| > Maybe the EnableTheming() and SetWindowTheme() functions are what you
need.
| >
| > Hope that helps!
| >
| > Gary Chang
| > Microsoft Online Partner Support
| > Get Secure! -
www.microsoft.com/security
| > This posting is provided "AS IS" with no warranties,and confers no
rights.
| > --------------------
| > | From: "Stephan Schaem" <
[email protected]>
| > | Subject: Emulating EnableVisualStyles()
| > | Date: Tue, 21 Oct 2003 19:57:31 -0700
| > | Lines: 54
| > | MIME-Version: 1.0
| > | Content-Type: multipart/alternative;
| > | boundary="----=_NextPart_000_00FC_01C3980D.904F51A0"
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#
[email protected]>
| > | Newsgroups:
| > microsoft.public.dotnet.framework,microsoft.public.dotnet.languages.vc
| > | NNTP-Posting-Host: adsl-64-167-237-174.dsl.scrm01.pacbell.net
| > 64.167.237.174
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:29625
| > microsoft.public.dotnet.framework:56763
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.vc
| > |
| > | How does one write an unmanaged function that perform this
functionality?
| > | In short I want to turn off/on visual style in my app...
| > | Thanks,
| > | Stephan
| > | PS: two people have been looking for some time, and no solution aside
| > putting the manifest
| > | in a file, and renaming the file before startup was found... very ugly
| > hack ...
| > |
| >
|
|
|