473,761 Members | 8,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running an Exe process then hidding?


I need to find a way to run an external exe (using the process class I
assume) and hide. When the process is closed I want my application to
reappear.

For example, press a button on form1, run notepad and hide form1. Close
notepad and form1 reappears.

Any ideas?

Thanks.
Nov 16 '05 #1
4 6938
try something like this for a no-brainer solution

private void button1_Click(o bject sender, System.EventArg s e)
{
Process p = Process.Start(" notepad.exe");
this.Visible = false;
p.WaitForExit() ;
this.Visible = true;
}

;-)

"news.microsoft .com" <no**@none.co m> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...

I need to find a way to run an external exe (using the process class I
assume) and hide. When the process is closed I want my application to
reappear.

For example, press a button on form1, run notepad and hide form1. Close
notepad and form1 reappears.

Any ideas?

Thanks.

Nov 16 '05 #2
hi
yes .. it could be done through the proccess class and here is a general
idea; you will use the process of the System.Diagnost ic namespace. Start
the notepad, hide you process, form one, pass a handler (IntP) of your
process to the other new one notepad (you do that through API calls). Once
done working with process two, you will do another API call (using the
handler that you hold) to reshow your other process.
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #3
Hi,

I believe the following is what you are after

private void button1_Click(o bject sender, System.EventArg s e)
{
Process p = Process.Start(" Notepad.exe");
this.Hide();
p.WaitForExit() ;
this.Show();

}

Just create an application with a form, add a button and paste the code for
the click handler.
--
HTH
B\rgds
Stoitcho Goutsev (100) [C# MVP]
"news.microsoft .com" <no**@none.co m> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...

I need to find a way to run an external exe (using the process class I
assume) and hide. When the process is closed I want my application to
reappear.

For example, press a button on form1, run notepad and hide form1. Close
notepad and form1 reappears.

Any ideas?

Thanks.

Nov 16 '05 #4
if you want to simply minimize the application instead literally hiding all
it's forms use something like this:

private void button1_Click(o bject sender, System.EventArg s e)
{
Process p = Process.Start(" notepad.exe");
this.Owner.Wind owState = FormWindowState .Minimized;
p.WaitForExit() ;
this.Owner.Wind owState = FormWindowState .Normal;
}

and make sure that when you open the form that will start the external
process that you assign that form's owner

the owner must be the application's main Form

ex:

Form2 f2 = new Form2();
f2.Owner = this;
f2.Show();

"news.microsoft .com" <no**@none.co m> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...

I need to find a way to run an external exe (using the process class I
assume) and hide. When the process is closed I want my application to
reappear.


Nov 16 '05 #5

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

Similar topics

1
2592
by: wesley | last post by:
Hello, How do I pass object to the current running process? For example my assembly is called program.exe. Once program.exe is running sometime I want to call it again ie: program.exe /m do_stuff Now how do I pass that "do_stuff" to the currently running instance?
1
2045
by: Marc | last post by:
I want to write a C#/ASP.NET application where a user can go to a web page, start running a job, close their browser, and then come back later and see the results. The purpose for this application is for a user to be able to use a page on our intranet to start running a time-consuming reporting and analysis job. I'm not sure how to start a process in ASP.NET and then "detach" it, or how to check that it's still running later. I think that maybe...
3
442
by: Billg_sd | last post by:
Is there a programatic way in VB.NET to determine if a specific process is running? During an app update, I need to check if the component I'm about to replace is running. In UNIX I'd use: PS | grep -i MyApp Can this be done in .Net?
0
1719
by: Carlos Wong | last post by:
I have a problem... I need to do a SQL script runner. Somenthing like the query analizer, but hidding the code. I try with the sqlCommand, but doesn't work. The scripts have: "go"es, "commit"s, etc. And I need to present the command result. Somebody can give a recomendation about this, I try doing this:
6
21677
by: Moses M | last post by:
I posted this a short while ago , but I don't think I explained the problem clearly. Task Manager lists processes running on a local system, including a "user name" associated with each process (e.g. SYSTEM). My application needs to check if a particular process is running, and if so get the associated "owner". I am really trying to determine the security context in which the process was started. Thanks for any input. -- Moses
0
2190
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a command button in the application. So the code goes something like this: psiBat = New ProcessStartInfo(arrRun.Item(0)(1)) psiBat.WindowStyle = ProcessWindowStyle.Hidden
4
821
by: sneffe | last post by:
Hi, im writing a program to keep track of which programs is currently running. I would like to have the caption of running programs displayed in a textbox on my form. I cant seem to find an easy way to do this in vb.net. Does anybody have a piece of code that can help me? Thanks
5
6582
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same (System.Runtime.InteropServices.Marshal.ReleaseComObject(exApplication)) to solve my problem but could not. Background : My app uses a WebBrowser control to display to the user the contents of an Excel spreadsheet.:
4
2851
by: commander_coder | last post by:
Hello, I write a lot of CGI scripts, in Python of course. Now I need to convert some to long-running processes. I'm having trouble finding resources about the best practices to do that. I've found a lot of email discussions that say something like, "You need to educate yourself about the differences when you have long- running processes" but I've not had a lot of luck with finding things that explain the differences. I've seen some...
0
10115
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...
1
9905
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
9775
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
8780
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
7332
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
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
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...
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2752
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.