473,396 Members | 1,892 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,396 software developers and data experts.

C# Windows Forms and processes

Hi,

I would like to know if it is possible to have a process (such as a command
prompt or notepad) running as a child of an MDI Windows Form, i.e. a process
that runs inside a window form and does not run separately.

Thanks,
Guillermo Lopez
Jul 21 '05 #1
5 4825
Guillermo,

Maybe somebody else understands what you want, however at least I don not.

Cor
Jul 21 '05 #2
Maybe I didn't explain it detail, here is a better explanation:

Part of the code to display a windows form:

Application.Run(new Form1());

Then set property “IsMdiContainer = true” to determine that this window form
can itself contain more window forms.

Part of the code to display a windows form (a child) inside another (the
parent):

Child formChild = new Child();
formChild.MdiParent = this; // set parent
formChild.Show(); // display child
Part of the code to start a process:

Process p = new Process();
p.StartInfo.FileName="notepad.exe";
p.Start();

This process will start in a new window, independent of the parent window
form. My question is: how can I make this process to run as a child of the
parent window form (as a window inside the parent window form)?
Hope this is clearer,
Guillermo
Jul 21 '05 #3
Guillermo,

AFAIK can you not. The only thing that you can do it keep track on it. What
than fullfils probably your need by catching the output or by something as
beneath or the waitforexit in the process as bellow. (Pinging a http adres
using the proces). (There are things as the axwebbrowser what makes it
possible using interop).
http://msdn.microsoft.com/library/de...rexittopic.asp

\\\
Process p = new Process();
ProcessStartInfo pi = new ProcessStartInfo();
pi.UseShellExecute = false;
pi.RedirectStandardOutput = true;
pi.Arguments = "www.google.com";
pi.WorkingDirectory = "C:\\windows\\system32";
//this for nt* computers
pi.FileName = "ping";
p.StartInfo = pi;
p.Start();
System.IO.StreamReader sr = p.StandardOutput;
System.Text.StringBuilder sb = new System.Text.StringBuilder("");
int input = sr.Read();
while (input != -1)
{
sb.Append((char) input);
input = sr.Read();
}
MessageBox.Show(sb.ToString());
///

I hope this helps

Cor
Jul 21 '05 #4
Not sure if this will work, but worth a try. There is a windows API that you
can import called SetParent. Once you start Notepad you could find the
handle of the main window, call set parent passing the handle of your MDI
window.

http://msdn.microsoft.com/library/de.../setparent.asp

--
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

"Guillermo Lopez" <Gu************@discussions.microsoft.com> wrote in
message news:ED**********************************@microsof t.com...
Maybe I didn't explain it detail, here is a better explanation:

Part of the code to display a windows form:

Application.Run(new Form1());

Then set property "IsMdiContainer = true" to determine that this window form can itself contain more window forms.

Part of the code to display a windows form (a child) inside another (the
parent):

Child formChild = new Child();
formChild.MdiParent = this; // set parent
formChild.Show(); // display child
Part of the code to start a process:

Process p = new Process();
p.StartInfo.FileName="notepad.exe";
p.Start();

This process will start in a new window, independent of the parent window
form. My question is: how can I make this process to run as a child of the
parent window form (as a window inside the parent window form)?
Hope this is clearer,
Guillermo

Jul 21 '05 #5
Thanks Wayne,

That's what I was looking for.
I also found this website with an example of what I need to do:
http://codeproject.com/useritems/ByPassAutomation.asp

Regards,
Guillermo Lopez

Jul 21 '05 #6

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

Similar topics

2
by: Greg Bacchus | last post by:
Hi, I'm getting an exception that really has me stumped. It's sporadic at best, it's only happened a handful of times. This particular time it happened when the user pressed 'Alt-S' to save the...
4
by: Joey Powell | last post by:
Hello all. For a long time now I have been struggling with a .net Windows Forms problem. In several of my applications, I use the "Process" class from System.Diagnostics to accomplish various task...
15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
6
by: Ayende Rahien | last post by:
Excetremely annoying problem, I've an application with a long startup time. So I created another form with my logo in it to as a splash screen. The splash screen is run from another thread and is...
14
by: Brian Keating EI9FXB | last post by:
I wonder can anyone reccomment a solution to this problem. Let me explain, I've services running on my system, my application receives diagnostic messages from these services, what i want to do...
2
by: fperfect13 | last post by:
Hi, I have the folowing exception Exception : System.NullReferenceException: Object reference not set to an instance of an object. 00000019 3:30:48 PM at...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
0
by: gxl034000 | last post by:
Hi, I have been trying to use a .net Forms control in my webpage to open up an application(notepad) on the client. The control works fine when embedded in a windows form, but I keep getting a...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
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
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:
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...
0
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,...
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
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...
0
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...
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 projectplanning, 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.