Table of contents
TOC
折叠目录
展开目录

Application.Active 属性 (Visio)Application.Active Property (Visio)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

指示 Microsoft Visio应用程序对象所表示的实例是 Microsoft Windows 桌面上的活动应用程序 — — 具有突出显示的标题栏的应用程序。只读的。Indicates whether the instance of Microsoft Visio represented by the Application object is the active application on the Microsoft Windows desktop—the application that has the highlighted title bar. Read-only.

语法Syntax

表达式活动expression . Active

表达式_一个表示应用程序对象的变量。_expression A variable that represents an Application object.

返回值Return Value

IntegerInteger

注解Remarks

活动的应用程序在 Windows 桌面上是不同于活动 Visio 实例,通过对 OLE GetActiveObject方法 ( GetObject方法在 Microsoft Visual Basic) 的调用返回。该GetObject方法检索最近处于激活状态,它可能会也可能不是活动桌面应用程序在该时刻的 Visio 实例。所有实例的 Visio 当前正在运行的只有一个是活动 Visio 实例。The active application on the Windows desktop is distinct from the active Visio instance, which is returned by a call to the OLE GetActiveObject method ( GetObject method in Microsoft Visual Basic). The GetObject method retrieves the instance of Visio that was most recently activated, which may or may not be the active application on the desktop at that moment. Of all instances of Visio that are currently running, only one is the active Visio instance.

例如,假设启动一个 Visio 实例和一个其他应用程序,如 Microsoft Excel。For example, suppose you start one instance of Visio and one of another application, such as Microsoft Excel.

  • 如果 Visio 实例是活动的应用程序在您的桌面上, GetObject ("visio.application") 检索的实例,并将其活动的属性为TrueIf the instance of Visio is the active application on your desktop, GetObject (, "visio.application") retrieves that instance, and its Active property is True .

  • 如果激活 Microsoft Excel、 GetObject ("visio.application") 的实例检索同一个 Visio 实例中,但其活动属性为FalseIf you activate the instance of Microsoft Excel, GetObject (, "visio.application") retrieves the same instance of Visio, but its Active property is False .

如果应用程序对象的有效属性为True ,则可以假定 Visio 的相应实例是 Visio 的活动实例,除非就地属性也是如此。如果为就地编辑容器应用程序中激活 Visio 实例,该实例可能不必将自身报告为 Visio 的活动实例。If an Application object's Active property is True , you can assume that the corresponding instance of Visio is the active instance of Visio unless the InPlace property is also True . If an instance of Visio is activated for in-place editing in a container application, that instance may not necessarily report itself as the active instance of Visio.

示例Example

下面的 Visual Basic 程序演示了如何获取活动 Visio 实例中。The following Visual Basic program shows how to get the active instance of Visio.


Public Sub Active_Example() 

 Dim vsoApplication1 As Visio.Application 
 Dim vsoApplication2 As Visio.Application 

 'Create two new instances of Visio. 
 Set vsoApplication1 = CreateObject("visio.application") 
 Set vsoApplication2 = CreateObject("visio.application") 

 'Use the Active property to determine whether 
 'the instance of Visio is active. 'Result = False. Prints "0" in the Immediate window 
 Debug.Print vsoApplication1.Active 

 'Result = True. Prints "-1" in the Immediate window. 
 Debug.Print vsoApplication2.Active 

End Sub
© 2018 Microsoft