Promote Your Blog
Google

Monday, January 23, 2012

Accessing Processes In Visual Basic

To access processes with given name and setting their affinity,

Dim pa As System.IntPtr = 'integer

Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("myprocesses")

For Each pr As Process In pProcess
pr.ProcessorAffinity = pa
Next

Note:
1. Remove .exe (or any other executable extension) from process name
2. To get all processes on given machine,
Dim pProcess() As Process = System.Diagnostics.Process.GetProcesses()

Not giving any machine name in above statement means localhost

No comments:

Post a Comment