Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Manifest in resource script?

Manifest in resource script?

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++comgraphicstools
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Groulien
    wrote on last edited by
    #1

    I was messing around with resource files and such in C#. I found out that with a Compiled Resource Script you can add multiple icons to your applications. Then I found out that a manifest file allows you to force it to be run as admin. But a choice has to be made between the two (in c#). I came to the conclusion that the Compiled Resource Script must contain a manifest.(if this is faulty, please correct me.) I took a quick look into Resource Scripts (RC) C++ and saw something of a structure. IDI_ICON1 ICON "file.ico" IDB_BITMAP1 BITMAP "file.bmp" Taking a peek in the Resource.h file that was generated I noticed the definition for IDI_ICON1, same goes for IDB_BITMAP1. ICON and BITMAP seem keywords for the Resource Compiler (can't find their definitions in #includes). But what if I want to add a manifest? IDM_MAN MANIFEST "file.manifest" ends up with a folder called "Manifest" (including quotes, which does not happen with ICON and BITMAP). I've seen MSDN saying that a manifest can be to an existing (post-compile) binary file, but can it be done with Resource Script, compiled with RC.exe?

    The first rule of CListCtrl is you do not talk about CListCtrl - kornman

    D D I 3 Replies Last reply
    0
    • G Groulien

      I was messing around with resource files and such in C#. I found out that with a Compiled Resource Script you can add multiple icons to your applications. Then I found out that a manifest file allows you to force it to be run as admin. But a choice has to be made between the two (in c#). I came to the conclusion that the Compiled Resource Script must contain a manifest.(if this is faulty, please correct me.) I took a quick look into Resource Scripts (RC) C++ and saw something of a structure. IDI_ICON1 ICON "file.ico" IDB_BITMAP1 BITMAP "file.bmp" Taking a peek in the Resource.h file that was generated I noticed the definition for IDI_ICON1, same goes for IDB_BITMAP1. ICON and BITMAP seem keywords for the Resource Compiler (can't find their definitions in #includes). But what if I want to add a manifest? IDM_MAN MANIFEST "file.manifest" ends up with a folder called "Manifest" (including quotes, which does not happen with ICON and BITMAP). I've seen MSDN saying that a manifest can be to an existing (post-compile) binary file, but can it be done with Resource Script, compiled with RC.exe?

      The first rule of CListCtrl is you do not talk about CListCtrl - kornman

      D Offline
      D Offline
      David Magnotti
      wrote on last edited by
      #2

      If it's not a compiler bug, it could be possible the manifest data overwrites the resource information for icons. If that's the case, you might need to write a custom build step to manually add the manifest, or the icons. I would imagine it's the manifest overwriting the other resources.

      1 Reply Last reply
      0
      • G Groulien

        I was messing around with resource files and such in C#. I found out that with a Compiled Resource Script you can add multiple icons to your applications. Then I found out that a manifest file allows you to force it to be run as admin. But a choice has to be made between the two (in c#). I came to the conclusion that the Compiled Resource Script must contain a manifest.(if this is faulty, please correct me.) I took a quick look into Resource Scripts (RC) C++ and saw something of a structure. IDI_ICON1 ICON "file.ico" IDB_BITMAP1 BITMAP "file.bmp" Taking a peek in the Resource.h file that was generated I noticed the definition for IDI_ICON1, same goes for IDB_BITMAP1. ICON and BITMAP seem keywords for the Resource Compiler (can't find their definitions in #includes). But what if I want to add a manifest? IDM_MAN MANIFEST "file.manifest" ends up with a folder called "Manifest" (including quotes, which does not happen with ICON and BITMAP). I've seen MSDN saying that a manifest can be to an existing (post-compile) binary file, but can it be done with Resource Script, compiled with RC.exe?

        The first rule of CListCtrl is you do not talk about CListCtrl - kornman

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        nbgangsta wrote:

        But what if I want to add a manifest?
        IDM_MAN MANIFEST "file.manifest"
        ends up with a folder called "Manifest" (including quotes, which does not happen with ICON and BITMAP).

        It usually ends up looking something like:

        1 24 MOVEABLE PURE "res\\MyApp.exe.manifest"

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather

        1 Reply Last reply
        0
        • G Groulien

          I was messing around with resource files and such in C#. I found out that with a Compiled Resource Script you can add multiple icons to your applications. Then I found out that a manifest file allows you to force it to be run as admin. But a choice has to be made between the two (in c#). I came to the conclusion that the Compiled Resource Script must contain a manifest.(if this is faulty, please correct me.) I took a quick look into Resource Scripts (RC) C++ and saw something of a structure. IDI_ICON1 ICON "file.ico" IDB_BITMAP1 BITMAP "file.bmp" Taking a peek in the Resource.h file that was generated I noticed the definition for IDI_ICON1, same goes for IDB_BITMAP1. ICON and BITMAP seem keywords for the Resource Compiler (can't find their definitions in #includes). But what if I want to add a manifest? IDM_MAN MANIFEST "file.manifest" ends up with a folder called "Manifest" (including quotes, which does not happen with ICON and BITMAP). I've seen MSDN saying that a manifest can be to an existing (post-compile) binary file, but can it be done with Resource Script, compiled with RC.exe?

          The first rule of CListCtrl is you do not talk about CListCtrl - kornman

          I Offline
          I Offline
          i00
          wrote on last edited by
          #4

          nbgangsta wrote:

          But a choice has to be made between the two (in c#).

          ... not really... You could (like me) use the icon resource in c sharp for the icon and then use something like:

          If NativeMethod.IsProcessElevated = False Then
          'Elevate :)
          Dim proc As New ProcessStartInfo
          proc.UseShellExecute = True
          proc.WorkingDirectory = Environment.CurrentDirectory
          proc.FileName = Application.ExecutablePath
          proc.Verb = "runas"
          Using AppProcess As New Process
          AppProcess.StartInfo = proc
          Try
          AppProcess.Start()
          Catch ex As Exception
          'User probably closed
          Throw New Exception("UAC Authorization Failed")
          End Try
          AppProcess.WaitForExit()
          End Using
          Else
          'Do Admin Stuff
          End If

          I run this in a Main method ... so your version may need to be modified ... Also I am more familiar with VB ... so have left you to convert it to c# :) ... Also you will need to download the Microsoft UAC project from here[^] for this to work :) Kris

          i00 Spell Check - No Third Party Components Required!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups