473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

embedding executable as resource?

Hi,

Let's say I have a project, and I add notepad.exe into it and set its
property as an embedded resource.

Now, when I build the project and run it, I want my code to launch
notepad.exe. How can I do this?

Thanks in advance,
Davsi
Jun 27 '08 #1
4 3625
In the case of an unmanaged executable such as notepad.exe, you would need
to extract the bytes using GetManifestResourceStream, deposit the file on
the filesystem with the proper name and extension, and use the Process class
to execute it. For managed code, you could extract the bytes and load into
the AppDomain directly from memory.
-Peter
"davis" <da*******@gmail.comwrote in message
news:d2**********************************@y38g2000 hsy.googlegroups.com...
Hi,

Let's say I have a project, and I add notepad.exe into it and set its
property as an embedded resource.

Now, when I build the project and run it, I want my code to launch
notepad.exe. How can I do this?

Thanks in advance,
Davsi
Jun 27 '08 #2
Thanks Peter -- this is what I was afraid of. It would be an
unmanaged resource. Is there really *no other way*? Read the byte-
stream into memory and onto disk somewhere kind of defeats the whole
purpose of what I'm trying to accomplish. There is no way to have the
Process class execute on a byte[] array -- or any other solution?

On Jun 8, 12:26*pm, "Peter Bromberg [C# MVP]"
<pbromb...@nospammaam.yahoo.comwrote:
In the case of an unmanaged executable such as notepad.exe, you would need
to extract the bytes using GetManifestResourceStream, deposit the file on
the filesystem with the proper name and extension, and use the Process class
to execute it. *For managed code, you could extract the bytes and load into
the AppDomain directly from memory.
-Peter"davis" <davisf...@gmail.comwrote in message

news:d2**********************************@y38g2000 hsy.googlegroups.com...
Hi,
Let's say I have a project, and I add notepad.exe into it and set its
property as an embedded resource.
Now, when I build the project and run it, I want my code to launch
notepad.exe. *How can I do this?
Thanks in advance,
Davsi
Jun 27 '08 #3
davis wrote:
Thanks Peter -- this is what I was afraid of. It would be an
unmanaged resource. Is there really *no other way*? Read the byte-
stream into memory and onto disk somewhere kind of defeats the whole
purpose of what I'm trying to accomplish. There is no way to have the
Process class execute on a byte[] array -- or any other solution?
There is very little you can do.

The Windows operating system has some code to run executables.

If that support running from the file system and not from a
..NET embedded resource then ...

Arne
Jun 27 '08 #4
"davis" <da*******@gmail.comwrote:
Let's say I have a project, and I add notepad.exe into it and set its
property as an embedded resource.
Now, when I build the project and run it, I want my code to launch
notepad.exe. How can I do this?
You're not actually aiming to do this with Notepad, are you? Copyright law
applies.

Eq.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Merak | last post by:
I usually embed a XML manifest with my applications to have them support XP Visual Styles. I know I can embed the resource into the resources section of the compiled executable (under the type...
1
by: Ola Theander | last post by:
Dear subscribers I'm currently creating a small application that will run at the end of a web installation to configure a SQL Server. For this task I have a SQL batch file in the same format...
0
by: MikeY | last post by:
With Reference/Resource is there a way of embedding the .resource file within a folder of my application instead of having it in the main project /executing assembly area. i.e. if I have a folder...
4
by: Tamir Khason | last post by:
Following the scenario: client want the application in ONE file only and do not want to hear about more then one exe in directory. The application is about 10 projects (no other way to build 'cos...
0
by: Jon Pope | last post by:
I would like to associate an icon embedded within my C# executable with data files that the application creates. How would you recommend it be done? Ideally, I would like to use my installer to...
2
by: Matt | last post by:
I'm working on a plug-in for an application called DesktopSideBar for Windows. It emulates to some degree the Longhorn sidebar. The SDK for DesktopSideBar supports .NET plug-in development through...
34
by: priyanka | last post by:
Hi, I was wondering if we could parse or do something in the executable( whose source language was C). How can I use some scripting language like perl/python to find out the information about...
11
by: Dave Brown | last post by:
Hi there. Does anyone know if it's possible to embed a new resource into an assembly at runtime as well as update an existing (assembly) resource. Any assistance would be appreciated. Thanks.
5
by: Avi Kak | last post by:
Folks, Does regular expression processing in Python allow for executable code to be embedded inside a regular expression? For example, in Perl the following two statements $regex =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.