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" <ss*****@seriou smagic.com>
| References: <#j************ **@TK2MSFTNGP11 .phx.gbl>
<FP************ *@cpmsftngxa06. phx.gbl>
| Subject: Re: Emulating EnableVisualSty les()
| 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: <OF************ **@TK2MSFTNGP10 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.vc
| NNTP-Posting-Host: adsl-64-167-237-174.dsl.scrm01. pacbell.net
64.167.237.174
| Path:
cpmsftngxa06.ph x.gbl!cpmsftngx a09.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP10 .
phx.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:29672
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 programmaticall y.
|
| I've put together an MFC sample for you:
http://www.alexfeinman.com/download....=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
|
|
| "Gary Chang [MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:FP******** *****@cpmsftngx a06.phx.gbl...
| > 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/de...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" <ss*****@seriou smagic.com>
| > | Subject: Emulating EnableVisualSty les()
| > | Date: Tue, 21 Oct 2003 19:57:31 -0700
| > | Lines: 54
| > | MIME-Version: 1.0
| > | Content-Type: multipart/alternative;
| > | boundary="----=_NextPart_000_ 00FC_01C3980D.9 04F51A0"
| > | 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: <#j************ **@TK2MSFTNGP11 .phx.gbl>
| > | Newsgroups:
| > microsoft.publi c.dotnet.framew ork,microsoft.p ublic.dotnet.la nguages.vc
| > | NNTP-Posting-Host: adsl-64-167-237-174.dsl.scrm01. pacbell.net
| > 64.167.237.174
| > | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
| > | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:29625
| > microsoft.publi c.dotnet.framew ork:56763
| > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 ...
| > |
| >
|
|
|