_ExternalApplication2.Quit 方法

退出应用程序。

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
Sub Quit
用法
Dim instance As _ExternalApplication2

instance.Quit()
void Quit()

实现

_ExternalApplication.Quit()

备注

如果在使用 Quit 方法之前使用了 Close 方法,则不保存表单中已更改的数据,也不提示用户是否保存。然而,如果不使用 Close 方法而仅使用 Quit 方法,则在退出 InfoPath 应用程序之前将提示用户保存表单。

重要

只能由从表单模板打开的表单访问此成员,已使用"表单选项"对话框"安全和信任"类别将该模板配置为以完全信任状态运行。此成员要求直接调用方的完全信任并且不能由部分信任的代码使用。有关更多信息,请参阅 MSDN 上的"使用部分信任的代码中的库"。

示例

在以下示例(用 C# 编程语言编写)中,ExternalApplication 对象的 Quit 方法用于关闭 InfoPath:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);

 // Close the InfoPath form.
 infoPath.Close(@"C:\My Forms\Form1.xml");

 // Quit the InfoPath application.
 infoPath.Quit();
}

备注

上面的示例假定正在使用 Microsoft.Office.Interop.InfoPath 命名空间并引用 Microsoft InfoPath 3.0 类型库。

另请参阅

引用

_ExternalApplication2 接口

_ExternalApplication2 成员

Quit 重载

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间