function SetProcessAffinity(app, affinity)
var affinityPtr = dotNET.System.IntPtr.zctor(affinity);
var process = dotNET.System_Diagnostics.Process.GetProcessById(app.ProcessID);
process.ProcessorAffinity = affinityPtr;
var app = Sys.Process("MyApp");
Thanks for your help!
Your suggestion was helpful, but only partially. Function provided by you works fine only on XP platform. But I failed at attempt to run this function on Vista, Server 2008 R2 and Win 7 platforms (both x32 and x64 bit platforms).
I am following all the steps described in “Calling Functions From .Net Assemblies” topic, but attempt to run your function on platforms described above leads to “dotNet undefined” error message appearing.
Also in the “Calling Functions From .Net Assemblies” topic described that In order for the script engine to be able to call functions of .NET assemblies, TestComplete loads these assemblies into a special helper process. But this process is displayed only on XP and Vista platform (on Server 2008 and Win 7 it not available after following all the steps described in the topic).
The problem is that I should set process affinity especially on Vista, Server 2008 and Win 7 platform.
In our test cases, I work a lot with Explorer.exe and iexplore.exe processes. But these processes are very often crashes on Vista, 2008 and Win7 platforms (especially which are installed on multi-core PC) during the test cases run (description of my problem you can find here: http://www.automatedqa.com/forums/forum/post/?mode=singlethread&thread=2dfcc8b3-97e2-49cf-9201-f933a...).
I noticed that these applications crash much less when I set affinity of these processes to 1. But I can't set process affinity on Vista, Server 2008 and Win 7 platforms using .Net assemblies.
Could someone help me to solve any of my problems?