views:

471

answers:

2

I have a manifest embedded as a Windows resource. But what's the right way to apply it?

More specifically:

I have my .manifest file. It's the standard one to make an app use controls in the Windows XP/Vista visual style. When applied by being in the same directory as the .exe and suitably named, it works.

However, this approach is rather cumbersome. I'd like my .exe to be self-contained. Clearly it can be done, given that many of the apps on my computer manage to use the modern style without a separate manifest file.

So I had a look around, and finally found embedding the manifest as a resource. So I've added this line to my .rc file:

1 RT_MANIFEST "mdiedit.exe.manifest"

But what do I do next?

Edit: If it helps you to know, my program is written in D and built using the Digital Mars D and resource compilers. No IDE. But I'd expect any solution that works in C(++), when built using command-line tools, to work in D as well.

A: 

Did you add the .rc file to your project yet? Alternatively, use your development environment's resource compiler, such as brcc32.exe or rc.exe, to compile the .rc file into a .res file, and then add that file to your project.

Remy Lebeau - TeamB
Already done. No effect. (If I hadn't, then none of my dialogs, menus or icons would be working.) Maybe your IDE automagically adds runtime code when you do this?
Stewart
Nope, there is no runtime code involved. It compiles .rc files directly into the executable resources.
Remy Lebeau - TeamB
+2  A: 

RT_MANIFEST is a define, so make sure your resource file includes the correct header, or just replace RT_MANIFEST with 24

Anders
That worked, thanks! (Lesson learned: the Windows headers shipped with DMC are out of date.) How actually does the resource compiler interpret an unknown resource type? Are they just like resource IDs in that they can be words or numbers?
Stewart
Resource ID's can be strings or numbers. ...And if it worked, how about marking the answer?
Anders