Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2005

Tip: Looking for answers? Try searching our database.

VC dialogs & XP themes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Egbert Nierop (MVP for IIS) - 23 Jul 2005 12:49 GMT
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
David Lowndes - 23 Jul 2005 16:07 GMT
>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/default.asp?url=/library/en-us/dnwxp/html/xpth
eming.asp


Dave
Signature

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

Egbert Nierop (MVP for IIS) - 23 Jul 2005 20:19 GMT
> >When I build some add-ins for the management console using C++, the
> >add-ins
[quoted text clipped - 7 lines]
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xpth
eming.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?
David Lowndes - 23 Jul 2005 23:57 GMT
>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
Signature

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

Egbert Nierop (MVP for IIS) - 24 Jul 2005 09:46 GMT
> >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
David Lowndes - 24 Jul 2005 15:47 GMT
>What I did:
>1) #include "commctrl.h"
[quoted text clipped - 3 lines]
>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-us/shellcc/platform/commctls/userex/cookboo
k.asp?frame=true#mmc


Dave
Signature

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

Ismail Pazarbasi - 25 Jul 2005 02:22 GMT
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.
David Lowndes - 25 Jul 2005 07:38 GMT
>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
Signature

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

Ismail Pazarbasi - 25 Jul 2005 18:38 GMT
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
austinf - 25 Jul 2005 20:43 GMT
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
Egbert Nierop (MVP for IIS) - 25 Jul 2005 09:12 GMT
> >What I did:
>>1) #include "commctrl.h"
[quoted text clipped - 11 lines]
> 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-us/shellcc/platform/commctls/userex/cookboo
k.asp?frame=true#mmc

>
> Dave
Egbert Nierop (MVP for IIS) - 25 Jul 2005 09:15 GMT
> >What I did:
>>1) #include "commctrl.h"
[quoted text clipped - 15 lines]
>
> http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/userex/cookboo
k.asp?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
Egbert Nierop (MVP for IIS) - 25 Jul 2005 09:32 GMT
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-us/shellcc/platform/commctls/userex/cookboo
k.asp?frame=true#mmc
)

> >What I did:
>>1) #include "commctrl.h"
[quoted text clipped - 17 lines]
>
> Dave
David Lowndes - 25 Jul 2005 12:22 GMT
>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
Egbert Nierop (MVP for IIS) - 25 Jul 2005 14:57 GMT
> >If you use ATL, no support for XP Theming is available.
>
[quoted text clipped - 5 lines]
>
> 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
Egbert Nierop (MVP for IIS) - 26 Jul 2005 09:04 GMT
>> >If you use ATL, no support for XP Theming is available.
>>
[quoted text clipped - 3 lines]
>>>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!
Ismail Pazarbasi - 26 Jul 2005 20:03 GMT
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
Egbert Nierop (MVP for IIS) - 27 Jul 2005 12:41 GMT
> 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.
[quoted text clipped - 11 lines]
> 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.
Ismail Pazarbasi - 28 Jul 2005 22:48 GMT
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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.