473,378 Members | 1,426 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,378 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 4821
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.