By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,081 Members | 1,885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,081 IT Pros & Developers. It's quick & easy.

VC dialogs & XP themes

P: n/a
When I build some add-ins for the management console using C++, the add-ins
made by me show a Win2000 interface while the rest of the add-ins made by MS
are using XP themes.

What am I missing?

Cheers

Nov 17 '05 #1
Share this Question
Share on Google+
18 Replies


P: n/a
>When I build some add-ins for the management console using C++, the add-ins
made by me show a Win2000 interface while the rest of the add-ins made by MS
are using XP themes.

What am I missing?


Have a look at:

http://msdn.microsoft.com/library/de.../xptheming.asp

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2

P: n/a
"David Lowndes" <da****@example.invalid> wrote in message
news:25********************************@4ax.com...
When I build some add-ins for the management console using C++, the
add-ins
made by me show a Win2000 interface while the rest of the add-ins made by
MS
are using XP themes.

What am I missing?


Have a look at:

http://msdn.microsoft.com/library/de.../xptheming.asp


Thanks a lot.
It's funny that XP was released in 2001, and Visual Studio 2003 in 2003 :)

Am I correct to say that ATL (shipped with Vstudio 2003 as well) simply does
not work with theming?

Nov 17 '05 #3

P: n/a
>Am I correct to say that ATL (shipped with Vstudio 2003 as well) simply does
not work with theming?


I don't see the connection. What has ATL to do with XP themes?

One of the limitations imposed by VS2003 (that wasn't in VS2002) is
that only Unicode builds get a manifest - so non-Unicode builds won't
appear themed. Is that perhaps the situation you're hitting?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #4

P: n/a
"David Lowndes" <da****@example.invalid> wrote in message
news:5l********************************@4ax.com...
Am I correct to say that ATL (shipped with Vstudio 2003 as well) simply
does
not work with theming?
I don't see the connection. What has ATL to do with XP themes?


I Know that ATL is not WTL but ATL has a lot of DialogImpl tools and VC
allows you to edit dialogs by using the resource editor.

There is a XPTHeme.cpp file, but I'm still puzzled why MS did not support
that out of the box or I'm simply missing some hidden feature?
What I did:
1) #include "commctrl.h"
2) #define ISOLATION_AWARE_ENABLED 1 (!! if you leave out the 1, it will not
compile!)3) #define MANIFEST_RESOURCE_ID 2
In the rc file
MANIFEST_RESOURCE_ID RT_MANIFEST "myDll.dll.manifest"(manifest contents not
shown here in this post)
One of the limitations imposed by VS2003 (that wasn't in VS2002) is
that only Unicode builds get a manifest - so non-Unicode builds won't
appear themed. Is that perhaps the situation you're hitting?
No, I stopped compiling for Win98 and ANSI compatible apps already 5 years
ago.
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq


Nov 17 '05 #5

P: n/a
>What I did:
1) #include "commctrl.h"
2) #define ISOLATION_AWARE_ENABLED 1 (!! if you leave out the 1, it will not
compile!)3) #define MANIFEST_RESOURCE_ID 2
In the rc file
MANIFEST_RESOURCE_ID RT_MANIFEST "myDll.dll.manifest"(manifest contents not
shown here in this post)


Other than compiling with the definition you mention, ensuring the
definition is visible for the appropriate include files, and ensuring
that your DLL really does have the manifest resource (open the DLL in
VS to be sure), I'm not aware that you have to do anything else to get
themes to work (though I've never tried with an MMC snap-in)

The following says pretty much the same:

http://msdn.microsoft.com/library/en...frame=true#mmc

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #6

P: n/a
It's not enough to add the manifest in your resource's textinclude, but
you need to add it to your resource.h file as well, if it's not in
there.

Nov 17 '05 #7

P: n/a
>It's not enough to add the manifest in your resource's textinclude, but
you need to add it to your resource.h file as well, if it's not in
there.


Huh?

Please explain what you mean.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #8

P: n/a
"David Lowndes" <da****@example.invalid> wrote in message
news:l8********************************@4ax.com...
What I did:
1) #include "commctrl.h"
2) #define ISOLATION_AWARE_ENABLED 1 (!! if you leave out the 1, it will
not
compile!)3) #define MANIFEST_RESOURCE_ID 2
In the rc file
MANIFEST_RESOURCE_ID RT_MANIFEST "myDll.dll.manifest"(manifest contents
not
shown here in this post)
Other than compiling with the definition you mention, ensuring the
definition is visible for the appropriate include files, and ensuring
that your DLL really does have the manifest resource (open the DLL in
VS to be sure), I'm not aware that you have to do anything else to get
themes to work (though I've never tried with an MMC snap-in)


Sure I did!
thanks however for the hint.
The following says pretty much the same:

http://msdn.microsoft.com/library/en...frame=true#mmc

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq


Nov 17 '05 #9

P: n/a
"David Lowndes" <da****@example.invalid> wrote in message
news:l8********************************@4ax.com...
What I did:
1) #include "commctrl.h"
2) #define ISOLATION_AWARE_ENABLED 1 (!! if you leave out the 1, it will
not
compile!)3) #define MANIFEST_RESOURCE_ID 2
In the rc file
MANIFEST_RESOURCE_ID RT_MANIFEST "myDll.dll.manifest"(manifest contents
not
shown here in this post)
Other than compiling with the definition you mention, ensuring the
definition is visible for the appropriate include files, and ensuring
that your DLL really does have the manifest resource (open the DLL in
VS to be sure), I'm not aware that you have to do anything else to get
themes to work (though I've never tried with an MMC snap-in)

The following says pretty much the same:

http://msdn.microsoft.com/library/en...frame=true#mmc


Indeed.
And such as docs suggest. MFC with C++.NET can by design handle themes if
you only add the resource stuff and the flags.

And ATL does not. If somebody can confirm me this, I simply know the next
step.

(Before someone says that ATL is not graphical such as MFC or WTL, I must
slightly disagree, ATL supports MMC snapins).
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq


Nov 17 '05 #10

P: n/a
For everybody's knowledge.

If you use ATL, no support for XP Theming is available. (I can't state such
for MFC b.t.w)
Use this
http://www.codeproject.com/w2k/themewrapper.asp

The wrapper is needed after applying the resource manifest to your
executable or DLL

(see
http://msdn.microsoft.com/library/en...frame=true#mmc)

"David Lowndes" <da****@example.invalid> wrote in message
news:l8********************************@4ax.com...
What I did:
1) #include "commctrl.h"
2) #define ISOLATION_AWARE_ENABLED 1 (!! if you leave out the 1, it will
not
compile!)3) #define MANIFEST_RESOURCE_ID 2
In the rc file
MANIFEST_RESOURCE_ID RT_MANIFEST "myDll.dll.manifest"(manifest contents
not
shown here in this post)


Other than compiling with the definition you mention, ensuring the
definition is visible for the appropriate include files, and ensuring
that your DLL really does have the manifest resource (open the DLL in
VS to be sure), I'm not aware that you have to do anything else to get
themes to work (though I've never tried with an MMC snap-in)

The following says pretty much the same:

http://msdn.microsoft.com/library/en...frame=true#mmc

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq


Nov 17 '05 #11

P: n/a
>If you use ATL, no support for XP Theming is available.

I can't see how you conclude something like that (other than the fact
that it's apparently not working in your circumstance).
Use this
http://www.codeproject.com/w2k/themewrapper.asp


What relevance has that article with ATL? It's title says it's for
owner drawn controls? Do you use an owner drawn control in your ATL
based MMC snap-in?

Dave
Nov 17 '05 #12

P: n/a
"David Lowndes" <da****@example.invalid> wrote in message
news:4l********************************@4ax.com...
If you use ATL, no support for XP Theming is available.
I can't see how you conclude something like that (other than the fact
that it's apparently not working in your circumstance).
Use this
http://www.codeproject.com/w2k/themewrapper.asp


What relevance has that article with ATL?


Why ask about relevance. If you know a better group, please tell me.
It's title says it's for
owner drawn controls? Do you use an owner drawn control in your ATL
The fact is, that non-owner drawn controls in ATL wont have XP styles.
Another fact is that developers in C# for instance, without a lot of
modification, can support styles and I've red the same about MFC.

ATL is left over. MS should make a clear point about their ATL support like
"ATL development has been frozen since 2000".

Now I'm not 100% sure whether or not I can support themes using the current
code or not.

based MMC snap-in?

Everything that I meet during development is ATL related.
If I do MFC, I would post it in MFC.

Dave


Nov 17 '05 #13

P: n/a
I mean:

3 TEXTINCLUDE
BEGIN
"CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST
"".\\myapp.exe.manifest""\r\n"
"\0"
END
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ".\myapp.exe.manifest"

in .rc file is not enough to enable visual styles. it also needs

#define IDR_MANIFEST 1

in resource.h

Nov 17 '05 #14

P: n/a
I know for a fact you can get XP themes to work in an atl dll. I have a
BHO built using ATL that has themes enabled in all of its dialog boxes.
If the host app supports linking in the commctrl dll via the isloation
aware method, then your atl dll should too..

Here is what I did.

1. added
/D ISOLATION_AWARE_ENABLED
to the command line args in the project properties. This is so it is
top level

2. added the standard manifest for common control v6 as a resource type
RT_MANIFEST and changed the id to 2.

3. in resource.h define IDR_MANIFEST to be 2

worked for me

Nov 17 '05 #15

P: n/a
"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:uz*************@TK2MSFTNGP15.phx.gbl...
"David Lowndes" <da****@example.invalid> wrote in message
news:4l********************************@4ax.com...
>If you use ATL, no support for XP Theming is available.


I can't see how you conclude something like that (other than the fact
that it's apparently not working in your circumstance).
Use this
http://www.codeproject.com/w2k/themewrapper.asp


Solution:
It has to be defined in resource.h and not in stdafx.h

For some, this might be obvious if the MSDN mentions this, but the MSDN does
only say:
Define a manifest resource ID of 2.

#define MANIFEST_RESOURCE_ID 2 Solution:had to be done in resource.h and not
in stdafx.h.Now it works!

Nov 17 '05 #16

P: n/a
Couple of months ago, I have realized that my application doesn't
support visual styles, even though I have added it into my .rc file.
Then I compared the project's .rc and resource.h files with another
project's ones (written with WTL), which supports visual styles, and I
have seen that IDR_MANIFEST is not defined in former one. This is why I
told you that it's not enough to have manifest in your .rc but you also
need to #define it in your resource.h.

I am not sure why, but, for example, having TYPELIB in .rc file is also
insufficient to embed type library in COM dll, if it's not defined in
resource.h.

May be this is not related to resource IDs, but with resource count.
Because I have defined my manifest resource id 241, and it worked as
well.

Ismail

Nov 17 '05 #17

P: n/a
"Ismail Pazarbasi" <pa*******@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Couple of months ago, I have realized that my application doesn't
support visual styles, even though I have added it into my .rc file.
Then I compared the project's .rc and resource.h files with another
project's ones (written with WTL), which supports visual styles, and I
have seen that IDR_MANIFEST is not defined in former one. This is why I
told you that it's not enough to have manifest in your .rc but you also
need to #define it in your resource.h.

I am not sure why, but, for example, having TYPELIB in .rc file is also
insufficient to embed type library in COM dll, if it's not defined in
resource.h.

May be this is not related to resource IDs, but with resource count.
Because I have defined my manifest resource id 241, and it worked as
well.


I can explain. If you don't define the correct resource_id, the typelibrary
won't be found by Windows by using FindResourceEx(..) or LoadMenu(..)
LoadTypeLib ...etc. A resource id is usedin those parameters.

The C++ compiler does not warn you if you forgot to define a resource id. I
found by opening the DLL in resource edit mode, that the manifest was having
an ID of 0.

Nov 17 '05 #18

P: n/a
in my resource.h:

#define IDR_MYTYPELIB 1111

in my .rc

1 TYPELIB "navigation.tlb"

this works fine. I am not sure whether this is "the correct" way, I
have seen this example on KB. What I don't understand here is the
relationship between IDR_MYTYPELIB and the typelib resource in .rc.
IDR_MYTYPELIB is not used in .rc. Same applies to manifest. I have
changed my manifest id to 241 in .h, it works again, but not used that
name/id in .rc.

Nov 17 '05 #19

This discussion thread is closed

Replies have been disabled for this discussion.