Ad Code

Responsive Advertisement

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

Post a Comment

0 Comments