View mode: basic / threaded / horizontal-split · Log in · Help
May 15, 2012
Windows application manifests
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
Re: Windows application manifests
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
Re: Windows application manifests
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
Re: Windows application manifests
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
Re: Windows application manifests
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 написал:
>
>> 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/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
>



-- 
Bye,
Gor Gyolchanyan.
May 15, 2012
Re: Windows application manifests
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
Re: Windows application manifests
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
Re: Windows application manifests
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 написал:
>
>  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
>



-- 
Bye,
Gor Gyolchanyan.
May 16, 2012
Re: Windows application manifests
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 16, 2012
Re: Windows application manifests
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.
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home