473,398 Members | 2,125 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,398 software developers and data experts.

Getting Current Process ID

Lex
I have a Class X that runs as an exe. Is there an easy way to get the
process Id of X as this class is running so that it can pass it along
to another class?

I know how to get all the processes and enumerate. I was hoping there
was some magic where I can say

int processId = GetMyCurrentProcessID()

Regards
Nov 15 '05 #1
1 61727
Use the static GetCurrentProcess() method on the Process class:

int nProcessID = Process.GetCurrentProcess().Id;
Arild

"Lex" <de**@homerlex.mailshell.com> wrote in message
news:c5*************************@posting.google.co m...
I have a Class X that runs as an exe. Is there an easy way to get the
process Id of X as this class is running so that it can pass it along
to another class?

I know how to get all the processes and enumerate. I was hoping there
was some magic where I can say

int processId = GetMyCurrentProcessID()

Regards

Nov 15 '05 #2

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

Similar topics

2
by: Max Berghammer | last post by:
Hi ! Is there any way to redirect the standard-outputstream or standard-errorstream of the currently running process ? I know that i can spawn a new process and redirect its standard-outputstream...
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();
13
by: Steve Enzer | last post by:
How can I get the login name of the user currently logged into Windows as a string? Thanks, Steve Enzer
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...
1
by: Maxwell2006 | last post by:
Hi, How can I get a list of AppDomains under the current process? Thank you,
3
by: dittytwo | last post by:
Hi all I have been looking around the web and can't seem to find a solution the solution that i have found and manipulated seems to bring back the whole list of currently running process's...
3
by: Thomas Morton | last post by:
This is a "thing" that has been annoying me all morning: and I can't work out how to do it. I need a way to get the DPI or screen resolution of the monitor that a script is currently runnign on....
0
by: PRR | last post by:
Here is a code i found on "how to enumerate appdomains in a current process". The original code was posted by Thomas Scheidegger Add the following as a COM reference -...
1
by: bandy | last post by:
Hi there, I am quite confusing in getting page number for pagination links. See what I am doing:I have a ShowDetails.php page on which I have created page links in for loop. Onclick of every...
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
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...
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,...
0
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...
0
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...
0
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,...
0
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...

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.