Kill a process
-
Hi all, We have a functionality that opens a word document on a button click . The user can enter any thing in the word document and it gets saved with a different name.The original document is closed. The problem is , every time the application is run, it opens a WINWORD.EXE in the processes tab of the task manager, which , after repeated executions of the project, add up to a large number.I cannot figure out why tjis is happening even as the word document is being closed after saving. So is there any way to close the process as soon as the document is saved with a differenty name? Thanks in anticipation
-
Hi all, We have a functionality that opens a word document on a button click . The user can enter any thing in the word document and it gets saved with a different name.The original document is closed. The problem is , every time the application is run, it opens a WINWORD.EXE in the processes tab of the task manager, which , after repeated executions of the project, add up to a large number.I cannot figure out why tjis is happening even as the word document is being closed after saving. So is there any way to close the process as soon as the document is saved with a differenty name? Thanks in anticipation
I have the same problem sometimes with Word 2003 when using outlook. If you use automation you'ld probably be able to use some function from the object model or something. If all else fails, look into the Process class. eg.: Process process = Process.GetCurrentProcess(); process.Kill(); hope this helps. Coulda, woulda, shoulda doesn't matter if you don't. :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig:
-
Hi all, We have a functionality that opens a word document on a button click . The user can enter any thing in the word document and it gets saved with a different name.The original document is closed. The problem is , every time the application is run, it opens a WINWORD.EXE in the processes tab of the task manager, which , after repeated executions of the project, add up to a large number.I cannot figure out why tjis is happening even as the word document is being closed after saving. So is there any way to close the process as soon as the document is saved with a differenty name? Thanks in anticipation
If you are using Interop dlls, so you should have used Word.Application object and the Documents collection to Add/Open a new Document. In this way, when you are done with the object, you can simple use Word.Application.Quit() method. It will close winword.exe automatically. Be sure you're not just openning the document and let it just be. Take care of that by events implementation. AISAC - An Intelligent Sense of A Computer http://aisac.wordpress.com -- modified at 14:29 Thursday 4th May, 2006
-
If you are using Interop dlls, so you should have used Word.Application object and the Documents collection to Add/Open a new Document. In this way, when you are done with the object, you can simple use Word.Application.Quit() method. It will close winword.exe automatically. Be sure you're not just openning the document and let it just be. Take care of that by events implementation. AISAC - An Intelligent Sense of A Computer http://aisac.wordpress.com -- modified at 14:29 Thursday 4th May, 2006
-
I have the same problem sometimes with Word 2003 when using outlook. If you use automation you'ld probably be able to use some function from the object model or something. If all else fails, look into the Process class. eg.: Process process = Process.GetCurrentProcess(); process.Kill(); hope this helps. Coulda, woulda, shoulda doesn't matter if you don't. :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig:
-
hi, Process proc =Process.GetCurrentProcess() Proc.Kill() is killing my application but not the winword.. Is there a way to identify the winword process uniquely and kill it? Thanks...
You didn't read correctly :-). Look up the Process class on MSDN. This was just an example:
Process proc =Process.GetCurrentProcess(); //is idd your own process Proc.Kill()
You can find the process by name or by id. Coulda, woulda, shoulda doesn't matter if you don't. :beer:
:jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: :jig: -
hi, Thanks for the reply.. I tried Word.Application.Quit().. It gave me the following error.. Reference to a non-shared member requires an object reference... I guess i will have to use process.kill()... Thanks..
For Word.Application.Quit I meant the path to the method, actually you should have an object like this: Word.Application wApp = new Word.Application(); Word.Document wDoc = wApp.Documents.Open("foo.doc"); ... wDoc.Close(); wApp.Quit(); AISAC - An Intelligent Sense of A Computer http://aisac.wordpress.com
-
For Word.Application.Quit I meant the path to the method, actually you should have an object like this: Word.Application wApp = new Word.Application(); Word.Document wDoc = wApp.Documents.Open("foo.doc"); ... wDoc.Close(); wApp.Quit(); AISAC - An Intelligent Sense of A Computer http://aisac.wordpress.com
Thanks for the reply, I am using wDoc.Close() wApp.Quit() It is closing the document but not the associated winword.exe. After repeated runs of the application, i have a lot of winword.exe's running in the task manager. how to close the associated process after the document is saved and closed?? Thanks in anticipation