I am wondering how to enable visual styles on a windows form that is created
by a BHO? I created the BHO in C# and I have tried the usual method of
calling Application.EnableVisualStyles(), but that does not work, and usually
causes IE to crash.
Any thoughts?
Thanks,
Peter
http://msdn.microsoft.com/library/en-us/mmc/mmc/supporting_visual_styles_in_snap_ins.asp
It talks about MMC snap-ins, but the same technique has to be done by
any DLL that creates windows and wants them to be themed.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Ismail
How is this done when your assembly is not an exe, but a dll? The only way
I was able to get it to work was to create a manifest for iexplore.exe and
copy it to the Internet Explorer folder, which does enable xp themes --- is
this the accepted way of doing it?
Thanks,
Peter
An MMC snap-in _is_ a DLL. The article applies to any DLL, and does
_not_ apply to EXEs. I don't understand your question.
As instructed in the MSDN article, I created a manifest file, added a
reference to the Microsoft Common Control, but I got lost trying to figure
out how to 'Set the ISOLATION_AWARE_ENABLED directive' or to reference the
manifest file. (Not sure how to translate this into .net/c#) .
Maybe i should just ask the question of how to complete the final steps from
the article using C#?
Thanks,
Peter
Thanks,
Peter
Ismail
Ismail
Yes it's different. An EXE should use CREATEPROCESS_MANIFEST_RESOURCE_ID
(defined as 1), a DLL should use ISOLATIONAWARE_MANIFEST_RESOURCE_ID
(defined as 2).
Ismail
I have the same pb, I don't arrive displaying a ATL Dialog Box with a
XP Style.
I rode the article propose by Igor but it didn't works.
I don't understand my mistake.
This is the description of my process:
- I created a manifest file
- In the beginning of the stdafx.h file I added :
#define ISOLATION_AWARE_ENABLED 2
#define MANIFEST_RESOURCE_ID 2
- In the end of stdafx.h, I added :
#include "commctrl.h"
- I added in the MyBho.rc the following line:
MANIFEST_RESOURCE_ID RT_MANIFEST "res\\MyBho.manifest"
I tested this but I keep the same style :(
Natturaly I'm using XP.
Do you see my mistake ?
Thx
Seb
Ismail
Thx
Seb
Put that into resource.h, not stdafx.h. The former is included in .rc,
the latter is not, so the resource compiler never sees your define.
Alternatively, write
ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\MyBho.manifest"
ISOLATIONAWARE_MANIFEST_RESOURCE_ID is already defined appropriately.
but I always have the same problem :(
It isn't work.
One query, what is the difference between the rc file and the rc2 file
?
Do you know where I can find a sample ?
I repeat my new process:
In Stdafx.h :
#include "commctrl.h"
In resource.h (in beginning):
#define ISOLATION_AWARE_ENABLED 2
#define MANIFEST_RESOURCE_ID 2
MyDll.manifest (in the 'res' directory) :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Company.abc.MyDll"
type="win32"
/>
<description>MyDll</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
MyDll.rc :
#include "resource.h"
ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\MyDll.manifest"
None really. Just a naming convention. The IDE manages the .rc file for
you, inserting and removing pieces as you work in resource editors, so
it is somewhat difficult to put handwritten code in there. So when one
needs to, it is customary to create a .rc2 file, put any custom code
there, and #include it in .rc . The IDE does not touch .rc2.
By the way, to include anything in .rc and make sure it stays put, do
the following. In the IDE, open Resource Viewer, right-click on
ProjectName.rc node and choose Resource Includes. A dialog appears with
two large edit boxes. Whatever you put in the top box will appear at the
beginning of your .rc file. It usually already contains #include
"winres.h" line - put any additional headers there. The contents of the
bottom box will be placed at the end of .rc file. You can specify some
resource statements there directly (e.g. the one-liner that includes the
manifest) or you can #include "your.rc2" if you have a lot of custom
resource code that you want to conveniently edit in a regular code
editor.
> Do you know where I can find a sample ?
>
> I repeat my new process:
>
> In Stdafx.h :
> #include "commctrl.h"
>
> In resource.h (in beginning):
> #define ISOLATION_AWARE_ENABLED 2
That goes into stdafx.h, not into resource.h - and make sure you put it
at the very top, before including any Windows headers.
> #define MANIFEST_RESOURCE_ID 2
That one goes into resource.h - or, if you use
ISOLATIONAWARE_MANIFEST_RESOURCE_ID, you don't need it at all.
I'm despairing ...
Fly fly my pig
Other ideas Igor ?
Seb
Thank you very much guru Igor.