C# Class Smrf.AppLib.ExcelApplicationKiller

Kills an Excel application's process on demand.
The KillExcelApplication method kills the process running an Excel application. It can be used to guarantee that an Excel application started from a parent process is removed from memory when the parent process is done with the Excel application.

There are various situations in which calling Application.Quit() will not remove the Excel application from memory; see this posting for more information:

http://www.dotnet247.com/247reference/msgs/68/344322.aspx

Suggested solutions involving calls to Marshall.ReleaseComObject(), never referencing an Excel object more than one level deep without storing it in an intermediate variable, and so on, are either unreliable or fragile and grossly impractical. This class offers a brute-force workaround for all those problems.

Inheritance: Object
Show file Open project: 2014-sed-team3/term-project Class Usage Examples

Protected Properties

Property Type Description
m_iProcessID System.Int32

Public Methods

Method Description
ExcelApplicationKiller ( Microsoft visibleExcelApplication ) : System

Initializes a new instance of the ExcelApplicationKiller class.

KillExcelApplication ( ) : void

Private Methods

Method Description
AssertValid ( ) : void

Method Details

ExcelApplicationKiller() public method

Initializes a new instance of the ExcelApplicationKiller class.
public ExcelApplicationKiller ( Microsoft visibleExcelApplication ) : System
visibleExcelApplication Microsoft /// The Excel application that will be killed by . The application must be visible. ///
return System

KillExcelApplication() public method

public KillExcelApplication ( ) : void
return void

Property Details

m_iProcessID protected property

protected Int32,System m_iProcessID
return System.Int32