www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Windows application manifests

reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Can anyone, please, tell me what these manifests are, where do they fit in
my application binaries, why is one needed to get the pretty windows 7
buttons and how to use them with DMD?

-- 
Bye,
Gor Gyolchanyan.
May 15 2012
next sibling parent reply "Kagamin" <spam here.lot> writes:
Manifests are extensible resources, they are used for various 
things which require storing metadata in executable modules, for 
example they're used to load version 6 of comctl32.dll instead of 
version 5 (pre-XP), thus getting different set of common 
controls, which support ux themes.
May 15 2012
parent reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
On Tue, May 15, 2012 at 8:07 PM, Kagamin <spam here.lot> wrote:

 Manifests are extensible resources, they are used for various things which
 require storing metadata in executable modules, for example they're used to
 load version 6 of comctl32.dll instead of version 5 (pre-XP), thus getting
 different set of common controls, which support ux themes.
Thanks for the reply! How do I include such a manifest to my DMD-built executable? -- Bye, Gor Gyolchanyan.
May 15 2012
parent reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
15.05.2012 20:16, Gor Gyolchanyan написал:
 On Tue, May 15, 2012 at 8:07 PM, Kagamin <spam here.lot
 <mailto:spam here.lot>> wrote:

     Manifests are extensible resources, they are used for various things
     which require storing metadata in executable modules, for example
     they're used to load version 6 of comctl32.dll instead of version 5
     (pre-XP), thus getting different set of common controls, which
     support ux themes.


 Thanks for the reply! How do I include such a manifest to my DMD-built
 executable?

 --
 Bye,
 Gor Gyolchanyan.
An example of my own preferred configuration: http://deoma-cmd.ru/files/other/DWinResExample.7z Everything in common folder is really common. `requestedExecutionLevel` should be also defined in manifest or Windows 6.x's UAC will use heuristics to choose required privilege level. -- Денис В. Шеломовский Denis V. Shelomovskij
May 15 2012
next sibling parent reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Thanks!
It doesn't compile. After I fixed the path to the Windows SDK, I got the
error: C:\Program Files (x86)\Microsoft
SDKs\Windows\v7.0A\Include\SpecStrings.h(11) : fatal error RC1015: cannot
open include file 'sal.h'

But what do windows resources have to do with the manifests?

On Tue, May 15, 2012 at 9:53 PM, Denis Shelomovskij <
verylonglogin.reg gmail.com> wrote:

 15.05.2012 20:16, Gor Gyolchanyan =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
 On Tue, May 15, 2012 at 8:07 PM, Kagamin <spam here.lot
 <mailto:spam here.lot>> wrote:

    Manifests are extensible resources, they are used for various things
    which require storing metadata in executable modules, for example
    they're used to load version 6 of comctl32.dll instead of version 5
    (pre-XP), thus getting different set of common controls, which
    support ux themes.


 Thanks for the reply! How do I include such a manifest to my DMD-built
 executable?

 --
 Bye,
 Gor Gyolchanyan.
An example of my own preferred configuration: http://deoma-cmd.ru/files/**other/DWinResExample.7z<http://deoma-cmd.ru/f=
iles/other/DWinResExample.7z>
 Everything in common folder is really common.

 `requestedExecutionLevel` should be also defined in manifest or Windows
 6.x's UAC will use heuristics to choose required privilege level.

 --
 =D0=94=D0=B5=D0=BD=D0=B8=D1=81 =D0=92. =D0=A8=D0=B5=D0=BB=D0=BE=D0=BC=D0=
=BE=D0=B2=D1=81=D0=BA=D0=B8=D0=B9
 Denis V. Shelomovskij
--=20 Bye, Gor Gyolchanyan.
May 15 2012
parent reply Denis Shelomovskij <verylonglogin.reg gmail.com> writes:
15.05.2012 22:08, Gor Gyolchanyan написал:
 Thanks!
 It doesn't compile. After I fixed the path to the Windows SDK, I got the
 error: C:\Program Files (x86)\Microsoft
 SDKs\Windows\v7.0A\Include\SpecStrings.h(11) : fatal error RC1015:
 cannot open include file 'sal.h'
Looks like you didn't change `/i"%ProgramFiles%\Microsoft Visual Studio 9.0\VC\include"` to your path (sal.h is there) or you hasn't it installed. -- Денис В. Шеломовский Denis V. Shelomovskij
May 15 2012
parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Thanks a lot! I'll look into it!

On Tue, May 15, 2012 at 11:21 PM, Denis Shelomovskij <
verylonglogin.reg gmail.com> wrote:

 15.05.2012 22:08, Gor Gyolchanyan =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
  Thanks!
 It doesn't compile. After I fixed the path to the Windows SDK, I got the
 error: C:\Program Files (x86)\Microsoft
 SDKs\Windows\v7.0A\Include\**SpecStrings.h(11) : fatal error RC1015:
 cannot open include file 'sal.h'
Looks like you didn't change `/i"%ProgramFiles%\Microsoft Visual Studio 9.0\VC\include"` to your path (sal.h is there) or you hasn't it installed=
.
 --
 =D0=94=D0=B5=D0=BD=D0=B8=D1=81 =D0=92. =D0=A8=D0=B5=D0=BB=D0=BE=D0=BC=D0=
=BE=D0=B2=D1=81=D0=BA=D0=B8=D0=B9
 Denis V. Shelomovskij
--=20 Bye, Gor Gyolchanyan.
May 15 2012
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 5/15/12, Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> wrote:
 But what do windows resources have to do with the manifests?
You use a resource file to load a manifest into the executable. There are a couple of examples here: https://github.com/AndrejMitrovic/DWinProgramming/tree/master/Samples/Extra/VisualStyles https://github.com/AndrejMitrovic/DWinProgramming/tree/master/Samples/Extra/VisualStyles2 https://github.com/AndrejMitrovic/DWinProgramming/tree/master/Samples/Extra/ThemedSimpleWakeUp https://github.com/AndrejMitrovic/DWinProgramming/tree/master/Samples/Extra/ThemedWakeUp enable-theme.xml is the manifest, and resource.rc just references this xml file. The resource file is compiled into a .res file, and this file is then passed directly to DMD. For your own purposes try to just take the .rc/.res/.xml files, pass .res to dmd when compiling your app and see if the visual styles work for you. The last example loads the manifest dynamically, based on a sample from the DFL library.
May 15 2012
prev sibling parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Tuesday, 15 May 2012 at 14:03:47 UTC, Gor Gyolchanyan wrote:
 Can anyone, please, tell me what these manifests are, where do 
 they fit in my application binaries, why is one needed to get 
 the pretty windows 7 buttons and how to use them with DMD?
Just FYI, you don't actually *need* to include manifests in your executable, if you know another DLL already has them. Here's a hack to show what I mean, for enabling visual styles: void enableVisualStyles() { TCHAR[MAX_PATH] dir; dir[GetSystemDirectory(dir.ptr, dir.length)] = '\0'; enum { ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x00000004, ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x00000008, ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x00000010, } auto actCtx = ACTCTX(ACTCTX.sizeof, ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_SET_PROCESS_DEFAULT | ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID, "shell32.dll", PROCESSOR_ARCHITECTURE_INTEL, 0, dir.ptr, MAKEINTRESOURCE(124), null, null); auto hActCtx = CreateActCtx(actCtx); assert(hActCtx != INVALID_HANDLE_VALUE); ULONG_PTR ulpActivationCookie; BOOL success = ActivateActCtx(hActCtx, ulpActivationCookie); assert(success); } Basically, since shell32.dll already has our manifest, I can just call this function instead. :-)
May 15 2012
parent reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
So, this function basically does... uhh.... I have no idea. :-D
What exactly does it do again?

On Wed, May 16, 2012 at 7:44 AM, Mehrdad <wfunction hotmail.com> wrote:

 On Tuesday, 15 May 2012 at 14:03:47 UTC, Gor Gyolchanyan wrote:

 Can anyone, please, tell me what these manifests are, where do they fit
 in my application binaries, why is one needed to get the pretty windows 7
 buttons and how to use them with DMD?
Just FYI, you don't actually *need* to include manifests in your executable, if you know another DLL already has them. Here's a hack to show what I mean, for enabling visual styles: void enableVisualStyles() { TCHAR[MAX_PATH] dir; dir[GetSystemDirectory(dir.**ptr, dir.length)] = '\0'; enum { ACTCTX_FLAG_ASSEMBLY_**DIRECTORY_VALID = 0x00000004, ACTCTX_FLAG_RESOURCE_NAME_**VALID = 0x00000008, ACTCTX_FLAG_SET_PROCESS_**DEFAULT = 0x00000010, } auto actCtx = ACTCTX(ACTCTX.sizeof, ACTCTX_FLAG_RESOURCE_NAME_**VALID | ACTCTX_FLAG_SET_PROCESS_**DEFAULT | ACTCTX_FLAG_ASSEMBLY_**DIRECTORY_VALID, "shell32.dll", PROCESSOR_ARCHITECTURE_INTEL, 0, dir.ptr, MAKEINTRESOURCE(124), null, null); auto hActCtx = CreateActCtx(actCtx); assert(hActCtx != INVALID_HANDLE_VALUE); ULONG_PTR ulpActivationCookie; BOOL success = ActivateActCtx(hActCtx, ulpActivationCookie); assert(success); } Basically, since shell32.dll already has our manifest, I can just call this function instead. :-)
-- Bye, Gor Gyolchanyan.
May 16 2012
parent reply "Mehrdad" <wfunction hotmail.com> writes:
On Wednesday, 16 May 2012 at 08:16:20 UTC, Gor Gyolchanyan wrote:
 So, this function basically does... uhh.... I have no idea. :-D
 What exactly does it do again?
Uh, it enableVisualStyles(). Without a manifest. :P
May 16 2012
parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
That is beyond cool! Thank you very much!!!

On Wed, May 16, 2012 at 1:39 PM, Mehrdad <wfunction hotmail.com> wrote:

 On Wednesday, 16 May 2012 at 08:16:20 UTC, Gor Gyolchanyan wrote:

 So, this function basically does... uhh.... I have no idea. :-D
 What exactly does it do again?
Uh, it enableVisualStyles(). Without a manifest. :P
-- Bye, Gor Gyolchanyan.
May 16 2012