M
Michael Tkachev
Hi Everybody,
I created an Excel file in the ASP.Net. When I wrote this file on the disk I
tryed to release COM objects. But I couldn't do it. When my method finished
an "Excel" process exists in the memory. So, I would like to kill an
"Excel" process and for it I need to know a ProcessID or something like
this. Who knows how can I get a processID or release COM objects?
Excel.ApplicationClass a = new Excel.ApplicationClass();
.... // Here lies my code.
a.Quit();
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(eRange) == 0);
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(_Worksheet) ==
0);
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(_Workbook) ==
0);
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(a) == 0);
_Worksheet = null;
eRange = null;
_Workbook = null;
a = null;
// Process[] p = Process.GetProcessesByName("EXCEL");
// foreach(Process pp in p)
// {
// pp.Kill();
// pp.Close();
// pp.Dispose();
// }
Thank you very much.
I created an Excel file in the ASP.Net. When I wrote this file on the disk I
tryed to release COM objects. But I couldn't do it. When my method finished
an "Excel" process exists in the memory. So, I would like to kill an
"Excel" process and for it I need to know a ProcessID or something like
this. Who knows how can I get a processID or release COM objects?
Excel.ApplicationClass a = new Excel.ApplicationClass();
.... // Here lies my code.
a.Quit();
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(eRange) == 0);
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(_Worksheet) ==
0);
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(_Workbook) ==
0);
while(System.Runtime.InteropServices.Marshal.ReleaseComObject(a) == 0);
_Worksheet = null;
eRange = null;
_Workbook = null;
a = null;
// Process[] p = Process.GetProcessesByName("EXCEL");
// foreach(Process pp in p)
// {
// pp.Kill();
// pp.Close();
// pp.Dispose();
// }
Thank you very much.