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

how to get the current status(running or Dead) of a process at any time?

hi
I wrote a class like this.......in my application.

public class cls
{
[DllImport("some.dll")]
[return : MarshalAs(UnmanagedType.Bool)]
public static extern bool myApp
(
[MarshalAs(UnmanagedType.LPStr)] ref string aa,
[MarshalAs(UnmanagedType.LPStr)] ref string bb,
[MarshalAs(UnmanagedType.I4)] ref int ProcessID,
[MarshalAs(UnmanagedType.I8)] ref long handle
);
public static int StartmyApp(string aa,string bb)/*this is function which calls the myapp*/
{
int processID = 0;
long handle = 0;
try
{
if(myApp(ref aa,ref bb,ref processID,ref handle))
{
nothing;
}
}
catch{ MessageBox.Show("Error in launching ");}

return processID;
}//end of function
}//end of cls class
problem description: myApp() is a function in a DLL which in turn starts a exe, myApp() function returns two values, they are processID and Handle of the exe or process started by that function.
Now i got to use the status of the process started by the above myApp() function, there are many places in my application where i need the status of the process whether the process is running or dead?.
How do i get the current status of the process at any time with latest information(live or dead)?

Hi tom walker and Willy Denoyette, have u got the clear picture of my problem

-------need HELP!
--------seash
Nov 15 '05 #1
2 2117
try {
Process proc= Process.GetProcessById(processID );
// Do something usefull with proc
Console.WriteLine("Process: {0} still active"
,proc.ProcessName);
....
}
catch(System.ArgumentException e) {
// Process with Id xxxx is doesn't exist)
}

Willy.
"seash" <an*******@discussions.microsoft.com> wrote in message
news:72**********************************@microsof t.com...
How do i get the current status of the process at any time with latest
information(live or dead)?

Hi tom walker and Willy Denoyette, have u got the clear picture of my
problem

-------need HELP!
--------seash

Nov 15 '05 #2
BIG Thanks Willy
u r somuch helpful to ameature like me. can i have u r email id so that i can post my queries to u at first
thanks again
seash
Nov 15 '05 #3

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

Similar topics

0
by: Doug | last post by:
In vb6 this is very simple, just set the panels style property to sbrTime. Is there a simple way to display the current time in a statusbar panel in .Net Thanks
1
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...
8
by: Chris | last post by:
Sorry, This should be simple, but brain is hurting... How do I convert a Current Time to a Decimal 6,0 (HMS)? There must be a cleaner way then this: Insert into Table Values Dec(...
2
by: MarthaR | last post by:
I am trying to add the current time to a field when the user clicks on the toggle button next to the field. I am getting a time of 12:00:00 AM each time I click the button. How do I get a...
18
by: Tim Quon | last post by:
Hi I need to print the current time. I found an example where this is done as followed: long *mytime; time(mytime); printf("time: %s", ascitime(mytime); But this doesn't work and prints...
3
by: Regis Melo | last post by:
Hello, I'm trying to get the "EXE" name of app that runs the current window. To get the current window I use: private static extern int GetForegroundWindow();
2
by: Sharon | last post by:
How do I find the full path where my current process is executed from? System.Environment.CurrentDirectory and System.IO.Directory.GetCurrentDirectory is not good enough because they may be...
4
by: Gary Wessle | last post by:
Hi I am not getting current time with this program, what am I doing wrong? #include <ctime> #include <iostream> using namespace std; #define P(x) cout << #x " = " << (x) << "\n";
2
by: anonymouse | last post by:
Hi Guys, I'm hoping that you could help me out with my little problem. I'm using VB6 and trying to create a form with a status bar. I would like to show the current time in military format...
18
by: rdahlstrom | last post by:
Does anyone know how to determine the window status (Running or Not Responding)? I've tried various methods with no success... This would be on a variety of Windows systems, but all at least XP,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.