Hi All,
I want to know if there is any way a complied EXE created in C# [App_A], can
be called by another EXE [App_MDI].
The App_MDI, should be the container for the App_A.
(In short App_A should be a child form in the App_MDI parent application)
note: App_A will only contain one form.
Thanks in Advance.
Sajid Saeed 12 6924
Sajid,
I don't think that there is. You could try and set the parent of the
window to be the MDI parent, but I have serious doubts as to whether or not
that will work. Also, calling the other EXE will cause it to be in another
process, it has its own message loop, etc, etc.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com
"Sajid Saeed" <hi******@hotmail.com> wrote in message
news:uB**************@TK2MSFTNGP11.phx.gbl... Hi All,
I want to know if there is any way a complied EXE created in C# [App_A],
can be called by another EXE [App_MDI]. The App_MDI, should be the container for the App_A. (In short App_A should be a child form in the App_MDI parent application)
note: App_A will only contain one form.
Thanks in Advance.
Sajid Saeed
Hi,
Thanks for ur comments, so it looks like, stand alone exe's will not be part
of the MDI.
I was expecting this answer...
Now is there anyway, where an assembly can be shared between two seperate
exe's, so that lets say if the parent application is closed, it forces the
other exe to clase as well.
Thanks once again
Sajid Saeed..
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:uU**************@tk2msftngp13.phx.gbl... Sajid,
I don't think that there is. You could try and set the parent of the window to be the MDI parent, but I have serious doubts as to whether or
not that will work. Also, calling the other EXE will cause it to be in
another process, it has its own message loop, etc, etc.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - ni**************@exisconsulting.com
Hi,
Could you actually show a code snippet on how this could actually be done.
Thanks
Sajid Saeed
"Chris Capel" <ch***@nowhere.com> wrote in message
news:#F**************@TK2MSFTNGP10.phx.gbl... Actually, there is a way, I believe. You just can't reference the file at compile time. You load it at runtime using Assembly.Load or LoadFrom, and then you use reflection to get the type of the form, and Activator.CreateInstance to create an instance of the type. Of course, the form in your EXE has to be of the right type and everything. But that
should do the trick. I use this sort of tactic to run all of the applications in
my system from a stub, with the files downloaded off of an application
server, to simplify deployment. Since they're EXEs, they can be run standalone if needed, but you can reference them (albeit awkwardly) as if they were libraries. This will probably work for you.
Hope this helps.
Chris
"Sajid Saeed" <hi******@hotmail.com> wrote in message news:uB**************@TK2MSFTNGP11.phx.gbl... Hi All,
I want to know if there is any way a complied EXE created in C# [App_A], can be called by another EXE [App_MDI]. The App_MDI, should be the container for the App_A. (In short App_A should be a child form in the App_MDI parent
application) note: App_A will only contain one form.
Thanks in Advance.
Sajid Saeed
Hi,
Sure i would like to see the code.
Thanks a mill.
Sajid Saeed
"Mark Mullin" <mu****@vibrant3d.com> wrote in message
news:32**************************@posting.google.c om... You can do this, but it's brutally complex. Also, you may need some C++ glue, it may not all be doable in C#. I've done this in C++ to run IE offscreen and snag it's rendered displays as textures in a 3D browser.
In concept, you can use Windows calls to launch the external EXE, ___providing parameters for the window to use that cause the EXE to use offscreen memory for rendering___. If you do everything ___very___ carefully, you can then snag the raw offscreen memory used for rendering, and transfer it to the other applications windows. This is not a procedure for the faint of heart.
I can post C++ code that does this if you want, I don't think it's a stunt I would recommend C# for. Not really what it's built for. You may learn far more than you want to about low level window management. But if you must, it is doable.
Ooof - now that I went and shot my mouth off, I've earned myself a
bunch of looking. Seems I am missing '99 where it counts. While I'm
doing that (it might take a while, I might just have to hack it again)
I've at least recalled the architecture.
A small C++ DLL was used to invoke IE as an active-x control, but did
so in an offscreen window. This was then wrapped by a java interface
lib built from the type library (i have that but fat lot of good it
does) and then our 3D browser used that to get images.
Hmmm, maybe I misspoke in the first place, I did just say IE active X
control, not .exe. Hmmm, my apologies.
So, a little research
1) ::CreateProcess doesn't seem on casual inspection to offer the
parameters you need to do this
2) Windows can't tell the difference between a memory dc and a real
screen window, but if it's a 3D view, glacially slow would be the
order of the day (no hardware accelleration). Actually, for that
matter, I think you loose all 2D hardware accelleration too.
The link http://www.experts-exchange.com/Prog..._20585994.html
might be of some use, it's a discussion by people trying to hook
CreateWindow and prevent the
javascript alert popup. (hmmm, do I smell an exploit ?). The PlanetCpp
post on that page gives code to show how to hook notepad, tho some
comments indicate it has a few problems.
My guess is that IFF you have sufficient permissions on the machine,
you _may_ be able to intercept the apps createwindow call. If so, you
need to create an offscreen window and give that to the app. Across
processes, this could be a serious pita, and you may need to research
it extensively. If it is possible, you'll also need to assume msft
may move to prevent it in the future. It has the potential to open a
nasty can of worms.
So, sorry for my poor recollection, I was actually thinking of running
activex components offscreen. Now if your target app happens to
provide an activex interface, then you should be all set
I'll keep rooting about off and on, it's an interesting question.
regards
mmm
"Sajid Saeed" <hi******@hotmail.com> wrote in message news:<ua**************@TK2MSFTNGP10.phx.gbl>... Hi,
Sure i would like to see the code.
Thanks a mill.
Sajid Saeed
"Mark Mullin" <mu****@vibrant3d.com> wrote in message news:32**************************@posting.google.c om... You can do this, but it's brutally complex. Also, you may need some C++ glue, it may not all be doable in C#. I've done this in C++ to run IE offscreen and snag it's rendered displays as textures in a 3D browser.
In concept, you can use Windows calls to launch the external EXE, ___providing parameters for the window to use that cause the EXE to use offscreen memory for rendering___. If you do everything ___very___ carefully, you can then snag the raw offscreen memory used for rendering, and transfer it to the other applications windows. This is not a procedure for the faint of heart.
I can post C++ code that does this if you want, I don't think it's a stunt I would recommend C# for. Not really what it's built for. You may learn far more than you want to about low level window management. But if you must, it is doable.
HAHA, I did it. Here's the code you need: (be sure to set
IsMdiContainer to true on the parent)
Form child=new Form();
Assembly asm=Assembly.LoadFile(***path to executable/dll***;
Type type=asm.GetType(***name of child form***,true,true);
object childform=Activator.CreateInstance(type);
child=(Form)childform;
child.MdiParent=this;
child.Show();
Austin Ehlers
On Mon, 21 Jul 2003 11:29:18 +0300, "Sajid Saeed"
<hi******@hotmail.com> wrote: Hi All,
I want to know if there is any way a complied EXE created in C# [App_A], can be called by another EXE [App_MDI]. The App_MDI, should be the container for the App_A. (In short App_A should be a child form in the App_MDI parent application)
note: App_A will only contain one form.
Thanks in Advance.
Sajid Saeed
Hi,
Thanks, i will have a go at it
Sajid
"Chris Capel" <ch***@nowhere.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl... Type childFormType = Assembly.LoadFrom(fullExePath).GetType(nameOfChild FormType);
Form childForm = Activator.CreateInstance(childFormType);
This will give you an instance of your child form. Then just add it like
you would a From from in the same assembly.
Chris
"Sajid Saeed" <hi******@hotmail.com> wrote in message news:uK**************@TK2MSFTNGP11.phx.gbl... Hi,
Could you actually show a code snippet on how this could actually be
done. Thanks
Sajid Saeed
"Chris Capel" <ch***@nowhere.com> wrote in message news:#F**************@TK2MSFTNGP10.phx.gbl... Actually, there is a way, I believe. You just can't reference the file
at compile time. You load it at runtime using Assembly.Load or LoadFrom, and then you use reflection to get the type of the form, and Activator.CreateInstance to create an instance of the type. Of course, the form in your EXE has to be of the right type and everything. But that
should do the trick. I use this sort of tactic to run all of the applications in my system from a stub, with the files downloaded off of an application server, to simplify deployment. Since they're EXEs, they can be run standalone if needed, but you can reference them (albeit awkwardly) as if they were libraries. This will probably work for you.
Hope this helps.
Chris
"Sajid Saeed" <hi******@hotmail.com> wrote in message news:uB**************@TK2MSFTNGP11.phx.gbl... > Hi All, > > I want to know if there is any way a complied EXE created in C# [App_A], can > be called by another EXE [App_MDI]. > The App_MDI, should be the container for the App_A. > (In short App_A should be a child form in the App_MDI parent application) > > note: App_A will only contain one form. > > Thanks in Advance. > > Sajid Saeed > >
Hi All,
I have written the code which is shown below, well actually copied yours...
Type childFormType =
Assembly.LoadFrom("c:\\WindowsApplication1").GetTy pe("WindowsForm",true,true
);
Form childForm = (Form)Activator.CreateInstance(childFormType);
childForm.MdiParent=this;
childForm.Show();
I get the following error during runtime, on the first line of code itself
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll
Additional information: File or assembly name WindowsApplication1, or one of
its dependencies, was not found.
you know what exactly am i doing wrong...
Sajid Saeed
I have written the code as per ur code.... shown below
Form child=new Form();
Assembly asm=Assembly.LoadFile("c:\\windowsapplication1.exe ");
Type type=asm.GetType("WindowsForm",true,true);
object childform=Activator.CreateInstance(type);
child=(Form)childform;
child.MdiParent=this;
child.Show();
and i get the following runtime error
An unhandled exception of type 'System.TypeLoadException' occurred in
WindowsApplication2.exe
Additional information: Could not load type WindowsForm from assembly
WindowsApplication1, Version=1.0.1300.21115, Culture=neutral,
PublicKeyToken=null.
Anything that i am missing....
Sajid Saeed
"Austin Ehlers" <th***********************@hotmail.com> wrote in message
news:dh********************************@4ax.com... HAHA, I did it. Here's the code you need: (be sure to set IsMdiContainer to true on the parent)
Form child=new Form(); Assembly asm=Assembly.LoadFile(***path to executable/dll***; Type type=asm.GetType(***name of child form***,true,true);
object childform=Activator.CreateInstance(type); child=(Form)childform; child.MdiParent=this; child.Show();
Austin Ehlers
On Mon, 21 Jul 2003 11:29:18 +0300, "Sajid Saeed" <hi******@hotmail.com> wrote:
Hi All,
I want to know if there is any way a complied EXE created in C# [App_A],
canbe called by another EXE [App_MDI]. The App_MDI, should be the container for the App_A. (In short App_A should be a child form in the App_MDI parent application)
note: App_A will only contain one form.
Thanks in Advance.
Sajid Saeed
Yes. The argument to LoadFrom has to be the complete filename. Include the
EXE extension.
Chris
"Sajid Saeed" <hi******@hotmail.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl... Hi All,
I have written the code which is shown below, well actually copied
yours... Type childFormType =
Assembly.LoadFrom("c:\\WindowsApplication1").GetTy pe("WindowsForm",true,true );
Form childForm = (Form)Activator.CreateInstance(childFormType);
childForm.MdiParent=this;
childForm.Show();
I get the following error during runtime, on the first line of code
itself An unhandled exception of type 'System.IO.FileNotFoundException' occurred
in mscorlib.dll
Additional information: File or assembly name WindowsApplication1, or one
of its dependencies, was not found. you know what exactly am i doing wrong...
Sajid Saeed
Thanks.... It works.... don't know what i would have done without you
guys...
Thanks once again
Sajid Saeed
"Austin Ehlers" <th***********************@hotmail.com> wrote in message
news:ru********************************@4ax.com... Comments inline.
On Thu, 24 Jul 2003 12:07:30 +0300, "Sajid Saeed" <hi******@hotmail.com> wrote:
I have written the code as per ur code.... shown below
Form child=new Form();
Assembly asm=Assembly.LoadFile("c:\\windowsapplication1.exe ");
Type type=asm.GetType("WindowsForm",true,true);
That should be Type type=asm.GetType("name of form in other app",true,true); Don't forget the namespace on it if you have one.
object childform=Activator.CreateInstance(type);
child=(Form)childform;
child.MdiParent=this;
child.Show();
and i get the following runtime error
An unhandled exception of type 'System.TypeLoadException' occurred in WindowsApplication2.exe
Additional information: Could not load type WindowsForm from assembly WindowsApplication1, Version=1.0.1300.21115, Culture=neutral, PublicKeyToken=null.
Anything that i am missing....
Sajid Saeed "Austin Ehlers" <th***********************@hotmail.com> wrote in message news:dh********************************@4ax.com.. . HAHA, I did it. Here's the code you need: (be sure to set IsMdiContainer to true on the parent)
Form child=new Form(); Assembly asm=Assembly.LoadFile(***path to executable/dll***; Type type=asm.GetType(***name of child form***,true,true);
object childform=Activator.CreateInstance(type); child=(Form)childform; child.MdiParent=this; child.Show();
Austin Ehlers
On Mon, 21 Jul 2003 11:29:18 +0300, "Sajid Saeed" <hi******@hotmail.com> wrote:
>Hi All, > >I want to know if there is any way a complied EXE created in C#
[App_A],can >be called by another EXE [App_MDI]. >The App_MDI, should be the container for the App_A. >(In short App_A should be a child form in the App_MDI parent
application) > >note: App_A will only contain one form. > >Thanks in Advance. > >Sajid Saeed >
Thanks.... It works.... don't know what i would have done without you
guys...
Thanks once again
Sajid Saeed
"Chris Capel" <ch***@nowhere.com> wrote in message
news:Oz**************@TK2MSFTNGP12.phx.gbl... Yes. The argument to LoadFrom has to be the complete filename. Include the EXE extension.
Chris
"Sajid Saeed" <hi******@hotmail.com> wrote in message news:ua**************@TK2MSFTNGP12.phx.gbl... Hi All,
I have written the code which is shown below, well actually copied yours... Type childFormType =
Assembly.LoadFrom("c:\\WindowsApplication1").GetTy pe("WindowsForm",true,true );
Form childForm = (Form)Activator.CreateInstance(childFormType);
childForm.MdiParent=this;
childForm.Show();
I get the following error during runtime, on the first line of code itself An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in mscorlib.dll
Additional information: File or assembly name WindowsApplication1, or
one of its dependencies, was not found. you know what exactly am i doing wrong...
Sajid Saeed
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: none |
last post by:
Howdy all,
I'm wondering if someone could give some direction on a problem I have
or share their experiences.
I'm wanting to create a little PHP application that will run on a
local machine...
|
by: David Pendrey |
last post by:
I was wondering if it is at all posible to write a stand alone .EXE program
in Visual Studio .NET. Hopefully in VB.NET but if not another language would
be ok. Thanks for the assistance
|
by: Todd D. Levy |
last post by:
What do I need to get (from Microsoft I assume) in order to distribute
stand alone Access applications to people who do not (and will not) have
Access installed on their systems?
I have heard...
|
by: Henry Wu |
last post by:
Hi, I am aware that TransparencyKey only works with top-level forms or
Non-MDI Child Forms, if one tries to set the opacity or
transparencykey property to a MDI-Child form, it will have no effect....
|
by: Bruin |
last post by:
Hi All,
I'm having a problem with MDI child forms when the
reference to the MDI Parent is set in a Control library.
(Sorry for
the long post)
I have an control library assembly which holds all...
|
by: Ulrich Wisser |
last post by:
Hi,
I would like to stop the postmaster every night and run
vacuum
pg_dump
reindex
in the stand alone backend.
|
by: Innova |
last post by:
Hi,
We are working on a gridview inside the gridview (parent-child) scenario.
The data of child grid will depend on the data of parent.
Objectives:
1.Add new row in parent grid after each row...
|
by: jim-on-linux |
last post by:
py help,
The file below will run as a stand alone file.
It works fine as it is.
But, when I call it from another module it locks
my computer, The off switch is the only
salvation.
This...
|
by: Marcolino |
last post by:
Hi,
another question for you.
I looked around but found nothing.
I have a MDI container calld frmMDIMain, that contain some child
form....one of that forms is called frmPostIt and I need that...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |