environment properties

Hi all, how can I retrieve the following properties from managed code in vb?
1. App Domain Name
2. Thread Name
3. Process ID
4. Process Name
5. Dll Name & Code Line

thanks!

[239 byte] By [ParamR] at [2008-2-10]
# 1
Hi Param R,

You will need to Import the following namespaces:
System.Threading
System.Diagnostics
System.Reflection

1. AppDomain.CurrentDomain.FriendlyName
2. Thread.CurrentThread.Name
3. Process.GetCurrentProcess().Id
4. Process.GetCurrentProcess().ProcessName
5. [Assembly].GetExecutingAssembly().FullName

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 2
Vikram, thanks a bunch. What about the Win32ThreadID?
ParamR at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 3
Hi,

For getting the Win32ThreadId, you can use: AppDomain.GetCurrentThreadId()

However, Microsoft warns users against using this, since they dont promise that it will never change. CLR threads are "virtualized" and can in theory change the physical OS thread they are running on at any time. In practice, in the current
version, it will never happen but in a future version it may.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 4
I am presuming that retrieves the .net managed code thread id. What about the win32 process/thread id from windows perspective? Are they the same? I noticed in Task Manager the process has a certain PID.

thanks

ParamR at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 5
Hi Param,

At the moment as of v1.1, both the IDs will be same but Microsoft claims that they may change this. And in future version at runtime, the Win32 Thread Id can change during execution of a program.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...

.NET Development

Site Classified