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

Identifying which WINWORD process to proc.kill()

I am extremely new to C#, so please respond using small words. :-) I am working on a client/server application which creates a word document and attaches it to an e-mail. Once the e-mail is sent, I need to kill the WINWORD process on the server. Unfortunately, everyone who uses this application is running under the same credentials, so I can not identify the correct process based on the user name. The session number does not seem to be unique either. I am thinking that I need to "catch" the PID for the WINWORD process as soon as it is started, and then reference that PID when I am ready to use proc.kill(). I am not certain how to get the PID when the process first kicks off, though. Any thoughts or suggestions would be appreciated.
Mar 17 '08 #1
1 3541
I am extremely new to C#, so please respond using small words. :-) I am working on a client/server application which creates a word document and attaches it to an e-mail. Once the e-mail is sent, I need to kill the WINWORD process on the server. Unfortunately, everyone who uses this application is running under the same credentials, so I can not identify the correct process based on the user name. The session number does not seem to be unique either. I am thinking that I need to "catch" the PID for the WINWORD process as soon as it is started, and then reference that PID when I am ready to use proc.kill(). I am not certain how to get the PID when the process first kicks off, though. Any thoughts or suggestions would be appreciated.
To follow up on this post, I have found a way to handle this issue. When the word document is created, I "grab" all of the procedures named "WINWORD", specifically the Process ID(PID) and the Start Time. I dump these into an array. Then I spin through the array doing a "bubble sort" to find the most recent start time (it is provided in a dateTime format). This provides me with the most recent process, which is the one that was just created. I save the PID in a session variable. Once I am finished with the document, I can then select the process based on the PID in my session variable and kill that specific process, while leaving everyone else's WINWORD processes alone.
Mar 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Tedmond | last post by:
Dear all, How can I get all the titles of all openning windows? I found a API in win32 that called EnumWindows() but it returns only the windows handles, not titles. How can I get the list just...
0
by: ray well | last post by:
hi, i shell out a process during my app's run, and then i want to close it when the program ends. i used the following code. it works fine with many files, for example an rtf file. Public...
5
by: Brett | last post by:
How do I gracefully kill a process than restart it? The process Image Name is known. Thanks, Brett
2
by: SMichal | last post by:
Hi. how can I terminate process which was started with cmd /c ? The Kill() method terminates only that CMD.exe string cdHome = @"C:\Temp\"; string localhost = "chsaXY"; string userName = "aaa";...
2
by: Anbu | last post by:
Hi all, I'm creating processes of a console based application. After proc.Start() the process is not getting terminated and the thread keeps waiting for some reponse from the process. Now I need...
4
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I know I can use this code to start a process. Any aimilar way to end one? System.Diagnostics.Process.Start("EcpKpScript_01.exe");
1
by: Newbie Coder | last post by:
In C++.NET 2003 Windows Forms App I fill a ListView control with process name & second column is the Process ID. I would like to kill the selected process, which is simple in VB.NET or C#,...
0
by: eddy82 | last post by:
Hi guys.I need some advice as i my db2 instance was kill off suddenly at late night and not sure what has kill it. 2008-10-14-22.47.53.326765+480 E31715373A878 LEVEL: Severe PID : 856268...
2
by: Dean Slindee | last post by:
Using this statement to utilize the spell checker in WinWord: WinOffice.clsWord.SpellChecker(txtNote.Text) 'this does not work because no main window is displayed 'Dim proc =...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.