473,915 Members | 7,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4851
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 “IsMdiContain er = 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.MdiPa rent = this; // set parent
formChild.Show( ); // display child
Part of the code to start a process:

Process p = new Process();
p.StartInfo.Fil eName="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();
ProcessStartInf o pi = new ProcessStartInf o();
pi.UseShellExec ute = false;
pi.RedirectStan dardOutput = true;
pi.Arguments = "www.google.com ";
pi.WorkingDirec tory = "C:\\windows\\s ystem32";
//this for nt* computers
pi.FileName = "ping";
p.StartInfo = pi;
p.Start();
System.IO.Strea mReader sr = p.StandardOutpu t;
System.Text.Str ingBuilder sb = new System.Text.Str ingBuilder("");
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.mi crosoft.com> wrote in
message news:ED******** *************** ***********@mic rosoft.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 "IsMdiConta iner = 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.MdiPa rent = this; // set parent
formChild.Show( ); // display child
Part of the code to start a process:

Process p = new Process();
p.StartInfo.Fil eName="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
3826
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 data that they were entering. Following is all exception information. Any thoughts much appreciated. Cheers
4
4776
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 from within my code (kind of like the old VB shell function). Using this process class appears to be just one example of what causes my Windows forms to look really crazy when running the application. In fact this has become not only a cosmetic...
15
3937
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. now use task manager to see the GDI usage of the process. everything seems normal. now catch the ListView's scroller and start to move it downwards. you have to hold the constant speed so that the ListView is constantly repainted. look at the...
6
2597
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 communicated solely through static method and Invoke()'s However, when I close my second form, the first one (main window) is hiding under all the windows on the desktop. If I don't close the splash screen, then everything is fine. I tried...
14
4926
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 is create an MDIChild window for each service that is sending messages. Ok so far so good, but I get problems if one service is constantly sending messages to it's window because, this window is very busy updating it's view, hence because it's...
2
5573
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 System.Windows.Forms.UnsafeNativeMethods.GetOpenFileName(OPENFILENAME_I ofn) 00000020 3:30:48 PM at
2
7866
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 in treeview i display the content item in axWebBrowser, i close the sub form normally when i close the main the following error is generated An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll ...
10
10062
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 believe that this has to do with unreleased form component events or event handlers. I'm comparatively new to .net and windows forms, in the sense that though I've been using them for over 2 years now, it's been rather sporadic. I work with...
0
2051
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 security exception when trying to run it from my webpage on my intranet. I have tried playing with the Code Access Security settings, but I can't get it to work. What do you think? Thanks,
21
3411
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 a zipcode that is unknown this form will open. I don't want users to modify any of this customers data until they close the zipcode form. Normally this can accomplished using a modal form, however this prevents me from opening a new copy of...
0
9883
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11359
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10928
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...
0
10543
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
9734
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, and deploymentwithout 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
8102
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
5944
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
6149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3370
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.