Re: Windows application manifests

2012-05-15 Thread Kagamin
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.


Re: Windows application manifests

2012-05-15 Thread Gor Gyolchanyan
On Tue, May 15, 2012 at 8:07 PM, Kagamin  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.


Re: Windows application manifests

2012-05-15 Thread Denis Shelomovskij

15.05.2012 20:16, Gor Gyolchanyan написал:

On Tue, May 15, 2012 at 8:07 PM, Kagamin mailto:s...@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


Re: Windows application manifests

2012-05-15 Thread 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'

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

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

> 15.05.2012 20:16, Gor Gyolchanyan написал:
>
>> On Tue, May 15, 2012 at 8:07 PM, Kagamin > > 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
>



-- 
Bye,
Gor Gyolchanyan.


Re: Windows application manifests

2012-05-15 Thread Andrej Mitrovic
On 5/15/12, Gor Gyolchanyan  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.


Re: Windows application manifests

2012-05-15 Thread Gor Gyolchanyan
Thanks for the detailed info! Definitely will check it out!

On Tue, May 15, 2012 at 10:38 PM, Andrej Mitrovic <
andrej.mitrov...@gmail.com> wrote:

> On 5/15/12, Gor Gyolchanyan  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.
>



-- 
Bye,
Gor Gyolchanyan.


Re: Windows application manifests

2012-05-15 Thread Denis Shelomovskij

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


Re: Windows application manifests

2012-05-15 Thread Gor Gyolchanyan
Thanks a lot! I'll look into it!

On Tue, May 15, 2012 at 11:21 PM, Denis Shelomovskij <
verylonglogin@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.


Re: Windows application manifests

2012-05-15 Thread Mehrdad

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 = 0x0004,
ACTCTX_FLAG_RESOURCE_NAME_VALID = 0x0008,
ACTCTX_FLAG_SET_PROCESS_DEFAULT = 0x0010,
}
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. :-)


Re: Windows application manifests

2012-05-16 Thread Gor Gyolchanyan
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  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 = 0x0004,
>ACTCTX_FLAG_RESOURCE_NAME_**VALID = 0x0008,
>ACTCTX_FLAG_SET_PROCESS_**DEFAULT = 0x0010,
>}
>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.


Re: Windows application manifests

2012-05-16 Thread Mehrdad

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


Re: Windows application manifests

2012-05-16 Thread Gor Gyolchanyan
That is beyond cool! Thank you very much!!!

On Wed, May 16, 2012 at 1:39 PM, Mehrdad  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.