5

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.

2
  • Well, can you verify that the EXE actually contains the manifest? I don't know if your environment can, but Visual Studio can open EXE files using the resource editor. If you can open the RT_MANIFEST resource and verify the contents. Commented Sep 10, 2009 at 8:23
  • Which is to say, on the surface of it you are doing everything correctly. If the manifest is in the EXE there is no separate API that needs to be called. Commented Sep 10, 2009 at 11:48

2 Answers 2

11

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

2
  • 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
    Commented Sep 10, 2009 at 20:32
  • 1
    Resource ID's can be strings or numbers. ...And if it worked, how about marking the answer?
    – Anders
    Commented Sep 10, 2009 at 23:51
0

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.

2
  • 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
    Commented Sep 9, 2009 at 23:42
  • Nope, there is no runtime code involved. It compiles .rc files directly into the executable resources. Commented Sep 15, 2009 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.