473,387 Members | 1,876 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,387 software developers and data experts.

How can I set affinity ofthe Word.Application object to one proces

Hi all,

We have noticed that using the Word OLE is much slower on dual processor
machines.
Limiting the processor affinity to one processor helps.
So, I want to set the affinity in my C# code.

I succeeded with the following code:
oWord = new Word.Application();
Process[] wordProcesses = Process.GetProcessesByName("WINWORD");
if (wordProcesses.Length == 1) {
(wordProcesses[0]).ProcessorAffinity = new IntPtr(1);
}

However, I only want to effect the WINWORD process I just created.
And not any others that might be running.
For now, I worked around this by seraching for the WINWORD process with the
latest timestamp. This works, but does not feel like great code.

Is there any way to get from an Word.Application object to its associated
process?
Can I get the ProcessID in some way?

Any help is appreciated,
Thanks,
Tony.
Oct 31 '06 #1
1 1866
You want to get the PID right? Here:
http://www.csharphelp.com/archives2/archive334.html

chanmm
"theTone" <th*****@discussions.microsoft.comwrote in message
news:21**********************************@microsof t.com...
Hi all,

We have noticed that using the Word OLE is much slower on dual processor
machines.
Limiting the processor affinity to one processor helps.
So, I want to set the affinity in my C# code.

I succeeded with the following code:
oWord = new Word.Application();
Process[] wordProcesses = Process.GetProcessesByName("WINWORD");
if (wordProcesses.Length == 1) {
(wordProcesses[0]).ProcessorAffinity = new IntPtr(1);
}

However, I only want to effect the WINWORD process I just created.
And not any others that might be running.
For now, I worked around this by seraching for the WINWORD process with
the
latest timestamp. This works, but does not feel like great code.

Is there any way to get from an Word.Application object to its associated
process?
Can I get the ProcessID in some way?

Any help is appreciated,
Thanks,
Tony.


Nov 1 '06 #2

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

Similar topics

5
by: The Roys | last post by:
Hi Im doing something wrong in quitting the Word.Application in my VB program. I have General Declarations Dim AppWord As Word.Application Form_Load() Set AppWord =...
3
by: DH | last post by:
I hope this is a right place to post my question I'm working on a Windows service application with VB.net. The purpose is to let the service application as a monitor to periodically check a...
8
by: sudha | last post by:
Hi, To open a word doc from c#, i use the following code : Word.ApplicationClass WordApp = new Word.ApplicationClass (); // give any file name of your choice. object fileName =...
4
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
1
by: SevDer | last post by:
Hi, I would like to know, if it is possible to maintain affinity by having a webgarden for our ASP.NET application in multi CPU server? And of course if possible without or minimal code change...
7
by: not_a_commie | last post by:
Here's some code I wrote trying to track down a deadlock bug. I was unable to make this code deadlock on my Core 2 Duo. I'd be interested, though, if y'all think it is the right way to use thread...
1
by: =?Utf-8?B?VmlqYXkgQ2hpa3Rl?= | last post by:
Hi Experts, With Session Affinity and Web Server Farm on ISA Server 2006 accessing 2 backend IIS servers, I’m getting error “Validation of ViewState MAC failed. If this application is hosted...
0
by: Armen Kirakosyan | last post by:
HI all !! have an appication which should spell check BUT ! I cannot dynamicaly change language, or set to autodetect the server in English, but I want it spell check in German or Spanish here...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.