473,837 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a stand alone exe as a child in an MDI container

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
Nov 15 '05 #1
12 6997
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************* *@exisconsultin g.com

"Sajid Saeed" <hi******@hotma il.com> wrote in message
news:uB******** ******@TK2MSFTN GP11.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

Nov 15 '05 #2
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************ **@exisconsulti ng.com> wrote
in message news:uU******** ******@tk2msftn gp13.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************* *@exisconsultin g.com

Nov 15 '05 #3
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******** ******@TK2MSFTN GP10.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.Creat eInstance 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******@hotma il.com> wrote in message
news:uB******** ******@TK2MSFTN GP11.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


Nov 15 '05 #4
Hi,

Sure i would like to see the code.

Thanks a mill.

Sajid Saeed

"Mark Mullin" <mu****@vibrant 3d.com> wrote in message
news:32******** *************** ***@posting.goo gle.com...
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.

Nov 15 '05 #5
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******@hotma il.com> wrote in message news:<ua******* *******@TK2MSFT NGP10.phx.gbl>. ..
Hi,

Sure i would like to see the code.

Thanks a mill.

Sajid Saeed

"Mark Mullin" <mu****@vibrant 3d.com> wrote in message
news:32******** *************** ***@posting.goo gle.com...
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.

Nov 15 '05 #6
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.Lo adFile(***path to executable/dll***;
Type type=asm.GetTyp e(***name of child form***,true,tr ue);

object childform=Activ ator.CreateInst ance(type);
child=(Form)chi ldform;
child.MdiParent =this;
child.Show();

Austin Ehlers

On Mon, 21 Jul 2003 11:29:18 +0300, "Sajid Saeed"
<hi******@hotma il.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


Nov 15 '05 #7
Hi,
Thanks, i will have a go at it

Sajid
"Chris Capel" <ch***@nowhere. com> wrote in message
news:ec******** ******@TK2MSFTN GP12.phx.gbl...
Type childFormType =
Assembly.LoadFr om(fullExePath) .GetType(nameOf ChildFormType);

Form childForm = Activator.Creat eInstance(child FormType);

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******@hotma il.com> wrote in message
news:uK******** ******@TK2MSFTN GP11.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******** ******@TK2MSFTN GP10.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.Creat eInstance 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******@hotma il.com> wrote in message
news:uB******** ******@TK2MSFTN GP11.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
>
>



Nov 15 '05 #8
Hi All,

I have written the code which is shown below, well actually copied yours...
Type childFormType =
Assembly.LoadFr om("c:\\Windows Application1"). GetType("Window sForm",true,tru e
);

Form childForm = (Form)Activator .CreateInstance (childFormType) ;

childForm.MdiPa rent=this;

childForm.Show( );

I get the following error during runtime, on the first line of code itself

An unhandled exception of type 'System.IO.File NotFoundExcepti on' occurred in
mscorlib.dll

Additional information: File or assembly name WindowsApplicat ion1, or one of
its dependencies, was not found.

you know what exactly am i doing wrong...

Sajid Saeed

Nov 15 '05 #9
I have written the code as per ur code.... shown below

Form child=new Form();

Assembly asm=Assembly.Lo adFile("c:\\win dowsapplication 1.exe");

Type type=asm.GetTyp e("WindowsForm" ,true,true);

object childform=Activ ator.CreateInst ance(type);

child=(Form)chi ldform;

child.MdiParent =this;

child.Show();
and i get the following runtime error

An unhandled exception of type 'System.TypeLoa dException' occurred in
WindowsApplicat ion2.exe

Additional information: Could not load type WindowsForm from assembly
WindowsApplicat ion1, Version=1.0.130 0.21115, Culture=neutral ,
PublicKeyToken= null.

Anything that i am missing....

Sajid Saeed
"Austin Ehlers" <th************ ***********@hot mail.com> wrote in message
news:dh******** *************** *********@4ax.c om...
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.Lo adFile(***path to executable/dll***;
Type type=asm.GetTyp e(***name of child form***,true,tr ue);

object childform=Activ ator.CreateInst ance(type);
child=(Form)chi ldform;
child.MdiParent =this;
child.Show();

Austin Ehlers

On Mon, 21 Jul 2003 11:29:18 +0300, "Sajid Saeed"
<hi******@hotma il.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

Nov 15 '05 #10

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

Similar topics

9
2926
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 and use ODBC to connect to a Access database on that machine. A series of forms will interact with the database but if I understand correctly, I need some way to parse the PHP code. Is there a stand alone parser that could be used in place of a...
121
9811
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
3
2452
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 about Run Time modules, but am unsure of what they are and how they are obtained. Is there a cost associated with this?
0
4497
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. So, I tricked my Transparent Non-MDI Child form into my MDI-Container form via SetParent API as seen here in my VB.NET sample ( http://wuhenry.beigetower.org/position.zip ). I thought my problems are over, but apprently, even though I...
0
1894
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 of my base classes including my base MDI Container form and my base MDI child form the mdi container has a singleton which returns an
7
4745
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.
0
8569
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 and add child grid into that row because the columns in child grid are same as parent grid and we want to align them with the cols of parent grid. 2. If there is data for child grid we show a plus image in the parent row (in the row above the...
2
2334
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 module when run as a stand alone, it will
7
2770
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 form stay always on top of all other child contained in MDI. is possinble to do this? Many thanks in advance
0
9839
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10564
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10621
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10268
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9396
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7806
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5668
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5846
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4039
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.