473,800 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Unman agedType.Bool)]
public static extern bool myApp
(
[MarshalAs(Unman agedType.LPStr)] ref string aa,
[MarshalAs(Unman agedType.LPStr)] ref string bb,
[MarshalAs(Unman agedType.I4)] ref int ProcessID,
[MarshalAs(Unman agedType.I8)] ref long handle
);
public static int StartmyApp(stri ng 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(liv e 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 2129
try {
Process proc= Process.GetProc essById(process ID );
// Do something usefull with proc
Console.WriteLi ne("Process: {0} still active"
,proc.ProcessNa me);
....
}
catch(System.Ar gumentException e) {
// Process with Id xxxx is doesn't exist)
}

Willy.
"seash" <an*******@disc ussions.microso ft.com> wrote in message
news:72******** *************** ***********@mic rosoft.com...
How do i get the current status of the process at any time with latest
information(liv e 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
329
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
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?
8
18896
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( Substr(Char(CURRENT TIMESTAMP),12,2) ||
2
10730
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 return of the current time? MarthaR
18
36383
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 some ugly numbers.
3
22613
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
13567
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 changed any many circumstance and not reflect the original location the current process is started from. Any Idea? ----------
4
9366
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
5631
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 (HH:nn:ss ex: 14:33:54) in one of the status bar's panels. So I set the set the style of the 2nd panel of the status bar to "sbrTime" but when I run the program, the time format displayed is hh:nn (02:33 PM). How can I change the format of the time...
18
3259
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, and mostly server 2003. Everyone will have Python 2.5.1 on them, and the script would be running locally. Any ideas?
0
10505
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
10253
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
10035
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
9090
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
7580
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
6813
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
5471
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
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.