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#
  4. Embed files in exe programmatically (pretty hard :( )

Embed files in exe programmatically (pretty hard :( )

Scheduled Pinned Locked Moved C#
csharpquestionvisual-studiotutorial
9 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.
  • S Offline
    S Offline
    sodevrom
    wrote on last edited by
    #1

    Hello, I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it. Please let me explain what I want. I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS. How can I do this ? In my oppinion, there are 2 ways to do this : add the image and details file in to the exe and also, change the exe icon. I don't think this is possible. create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software. How can I do that ? Is there any other way ? Did I explain correctly what I want ? PS: I am programming in VS 2008 c# with .net 3.5 Thank you

    L G D 4 Replies Last reply
    0
    • S sodevrom

      Hello, I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it. Please let me explain what I want. I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS. How can I do this ? In my oppinion, there are 2 ways to do this : add the image and details file in to the exe and also, change the exe icon. I don't think this is possible. create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software. How can I do that ? Is there any other way ? Did I explain correctly what I want ? PS: I am programming in VS 2008 c# with .net 3.5 Thank you

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      sodevrom wrote:

      create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software. How can I do that ? Is there any other way ? Did I explain correctly what I want ?

      Hello Sodevrom, Generating an .exe (executable) file from within your application is an impossible task! But yes, other executable files can make your way, like files with .vbs and .bat extensions (which are also executable). The source files are written in Notepad as usual and then are saved with a name and a required executable extension. You can use the FileStream property of .NET to create a notepad file and write the code to it. Then, you can use the File.Move(); function to rename the file to any execuatble extension you want, but not any .exe. Hope this information helps. For more information, search Google or MSDN. Happy Programming, Rajdeep.NET :-D

      1 Reply Last reply
      0
      • S sodevrom

        Hello, I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it. Please let me explain what I want. I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS. How can I do this ? In my oppinion, there are 2 ways to do this : add the image and details file in to the exe and also, change the exe icon. I don't think this is possible. create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software. How can I do that ? Is there any other way ? Did I explain correctly what I want ? PS: I am programming in VS 2008 c# with .net 3.5 Thank you

        G Offline
        G Offline
        Giorgi Dalakishvili
        wrote on last edited by
        #3

        Have a look at this article: SlideShowBuilder[^]

        Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

        S 1 Reply Last reply
        0
        • G Giorgi Dalakishvili

          Have a look at this article: SlideShowBuilder[^]

          Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

          S Offline
          S Offline
          sodevrom
          wrote on last edited by
          #4

          Hello, This is not exactly what I need. A friend of mine made me a DLL a while back, that had 3 functions : start_exe(string exe name) add_file(string file path,string source path) create_exe(icon path,string file_of_the_file_to_run_when_oppening_exe) And it worked perfectly in C++, but it does not work very good in c#. Any other ideeas ?

          1 Reply Last reply
          0
          • S sodevrom

            Hello, I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it. Please let me explain what I want. I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS. How can I do this ? In my oppinion, there are 2 ways to do this : add the image and details file in to the exe and also, change the exe icon. I don't think this is possible. create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software. How can I do that ? Is there any other way ? Did I explain correctly what I want ? PS: I am programming in VS 2008 c# with .net 3.5 Thank you

            D Offline
            D Offline
            Daniel Grunwald
            wrote on last edited by
            #5

            You want to replace resources in an existing .exe file? If the .exe file is a .NET assembly, that's pretty easy. Take a look at Mono.Cecil[^].

            S 2 Replies Last reply
            0
            • S sodevrom

              Hello, I have been struggling for the past 3 days to do this but I simply can't find any good info on how to do it. Please let me explain what I want. I have a compiled software. I want users to be able to brand this software with their own ICON, ABOUT IMAGE and DETAILS. How can I do this ? In my oppinion, there are 2 ways to do this : add the image and details file in to the exe and also, change the exe icon. I don't think this is possible. create an exe from my application, that will automaticaly add in it the Brandable Software File, About Image and Details file. When I run this newly created exe, it can extract the files in a temp file and run the Branded software. How can I do that ? Is there any other way ? Did I explain correctly what I want ? PS: I am programming in VS 2008 c# with .net 3.5 Thank you

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Hi, Create a DLL trigger for your application. Thats the easiest way. And by the way, C# enables you to create DLL the much better way, than any other language!

              1 Reply Last reply
              0
              • D Daniel Grunwald

                You want to replace resources in an existing .exe file? If the .exe file is a .NET assembly, that's pretty easy. Take a look at Mono.Cecil[^].

                S Offline
                S Offline
                sodevrom
                wrote on last edited by
                #7

                Hello, This is pretty difficult. Are you sure this will modify the resources from a .exe from another .exe file. So if I have APP1 that controls APP2, can I modify the resources of APP2 from APP1 ? Thank you

                D 1 Reply Last reply
                0
                • S sodevrom

                  Hello, This is pretty difficult. Are you sure this will modify the resources from a .exe from another .exe file. So if I have APP1 that controls APP2, can I modify the resources of APP2 from APP1 ? Thank you

                  D Offline
                  D Offline
                  Daniel Grunwald
                  wrote on last edited by
                  #8

                  Yes, Cecil can open .exe files, modify them, and save back the changes. Use something like this:

                  AssemblyDefinition asm = AssemblyFactory.GetAssembly("myassembly.exe");
                  asm.MainModule.Resources.Add(new EmbeddedResource(
                  "ResourceName", ManifestResourceAttributes.Public,
                  File.ReadAllBytes("image.png")
                  ));
                  AssemblyFactory.SaveAssembly(asm, "myassembly.branded.exe");

                  1 Reply Last reply
                  0
                  • D Daniel Grunwald

                    You want to replace resources in an existing .exe file? If the .exe file is a .NET assembly, that's pretty easy. Take a look at Mono.Cecil[^].

                    S Offline
                    S Offline
                    sodevrom
                    wrote on last edited by
                    #9

                    Hi, Cecil is great, actualy it's perfect. I have only one last request. Can you please tell me what would I have to do to change the default icon of the exe ? I am not lazy, but I am finding Cecil pretty difficult. Thank you again very much

                    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