Manifest in resource script?
-
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 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
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.
-
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
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
-
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
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 IfI 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