| Thread overview | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 09, 2009 Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated. Maybe should create that function at the level of the compiler or linker? | ||||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Valery | Valery Wrote:
> Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated.
>
> Maybe should create that function at the level of the compiler or linker?
As far as I know, the only way to get the newer common controls library is to use an assembly manifest, be it external or compiled as a resource. I haven't looked into DFL but I'm pretty sure it simply generates the proper manifest resource and link it in the executable.
| |||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Valery | On Wed, 09 Sep 2009 05:19:22 -0400, Valery <free_on@mail.ru> wrote: > Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated. > > Maybe should create that function at the level of the compiler or linker? Out of curiosity, why not use DFL? Since then you'd only have to call Application.enableVisualStyles(); I'm pretty sure both QT and GTK (or whatever GUI lib you want to use) also have a nice wrapper for enabling XP styles. | |||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jeremie Pelletier | Jeremie Pelletier Wrote:
> As far as I know, the only way to get the newer common controls library is to use an assembly manifest, be it external or compiled as a resource. I haven't looked into DFL but I'm pretty sure it simply generates the proper manifest resource and link it in the executable.
Yes, in DFL creates a manifest file and so on, but it's done at runtime by method enableVisualStyles.
I think that there should be a simpler way to enable new styles independent of library or native Win32 API you use.
| |||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Valery | Or at least describe the process of change styles through the manifest files in the documentation and the section D for Win32 on site. | |||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Valery | On 9/9/09 11:19, Valery wrote: > Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated. > > Maybe should create that function at the level of the compiler or linker? There is no good solution for this problem. I was working on this for DWT and you somehow always need to have a manifest file. The problem is that windows doesn't load the correct dll and that's what the manifest file is for. You can look at the bottom of http://hg.dsource.org/projects/dwt-win/file/210994f12c4c/README.txt for a couple of options. If I remember correctly DFL creates a manifest file at runtime and then loads it. /Jacob Carlborg | |||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Valery | Valery wrote: > Jeremie Pelletier Wrote: > >> As far as I know, the only way to get the newer common controls library is to use an assembly manifest, be it external or compiled as a resource. I haven't looked into DFL but I'm pretty sure it simply generates the proper manifest resource and link it in the executable. > > Yes, in DFL creates a manifest file and so on, but it's done at runtime by method enableVisualStyles. I think that there should be a simpler way to enable new styles independent of library or native Win32 API you use. Indeed, I'd like to know why M$ decided to bundle two versions of the relevant DLLs and require the programmer to use a manifest in order to access the modern version. > Or at least describe the process of change styles through the manifest files in the documentation and the section D for Win32 on site. Indeed, I drove myself mad trying to find out how to make it work, and eventually discovered keeping a .manifest file alongside the .exe. We need more resources (NPI) teaching how to do it the tidier way. Stewart. | |||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | On Wed, Sep 09, 2009 at 08:27:56PM +0100, Stewart Gordon wrote: > Indeed, I'd like to know why M$ decided to bundle two versions of the relevant DLLs and require the programmer to use a manifest in order to access the modern version. Backward compatibility. Details here: http://blogs.msdn.com/oldnewthing/archive/2008/01/29/7294949.aspx -- Adam D. Ruppe http://arsdnet.net | |||
September 09, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Stewart Gordon wrote: > Indeed, I drove myself mad trying to find out how to make it work, and eventually discovered keeping a .manifest file alongside the .exe. We need more resources (NPI) teaching how to do it the tidier way. In your .rc file (which more or less all WIN32 GUI apps needs anyway) write in a line like: CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "manifest.xml" *** In a separate file named: manifest.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Microsoft.Windows.Generic" type="win32" /> <description>YourApplication</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> Also to work, the executable flags of the .exe file has to specifiy NT version 4.0 or higher as a requirement (probably default in most compilers by now.) Roald | |||
September 10, 2009 Re: Modern Windows GUI visual styles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Valery Attachments: | Hi,
Take a look Windows API: CreateActCtx, ActivateActCtx, DeactivateActCtx and ReleaseActCtx and the struct ACTCTX
You still need a manifest file, but that file can generate by program, and you can turn on/off the XP theme.
"ACTCTX.lpSource Null-terminated string specifying the path of the manifest file or PE image to be used to create the activation context. If this path refers to an EXE or DLL file, the lpResourceName member is required."
The attachment is the cpp code I wrote for Java...
Regards,
Eric Suen
> Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated.
>
> Maybe should create that function at the level of the compiler or linker?
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply