Re: Invoking Console Application's Program.Main from another project
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Tue, 21 Jul 2009 09:52:02 -0700
On Mon, 20 Jul 2009 09:15:03 -0700, Shikari Shambu
<shikarishambu70@xxxxxxxxxxx> wrote:
Hi,
Is it possible to invoke the entry point of a console application project from another project. Or, do I have to invoke the associated exe as per the post below
http://blogs.msdn.com/csharpfaq/archive/2004/06/01/146375.aspx
You can try referencing the .exe as an assembly for your own application
(just as you would a managed .dll), and then calling the entry point
directly.
In unmanaged code, this would be an "iffy proposition", because doing so
might skip some important initialization. But I think there's a good
chance .NET would handle this correctly. I haven't done it myself, so I
don't know for sure, but if it's something you really want to do, you
might as well try.
If the other application isn't a managed application, you might be able to
still do it, by using the unmanaged LoadLibrary() and GetProcAddress().
But as I said, I would be less confident that could be done safely.
Simply loading the .exe as a library might cause the necessary
initialization to happen, but it might not; I don't recall the specifics.
Pete
.
- References:
- Invoking Console Application's Program.Main from another project
- From: Shikari Shambu
- Invoking Console Application's Program.Main from another project
- Prev by Date: Re: Blob and XML
- Next by Date: Generic abstract class
- Previous by thread: Re: Invoking Console Application's Program.Main from another project
- Next by thread: APkIYglUaXlJ
- Index(es):
Relevant Pages
|