标题: iFix从后台调度中访问或修改全局变量的代码 [打印本页]

作者: solszl2    时间: 2020-4-1 15:11
标题: iFix从后台调度中访问或修改全局变量的代码


1、从后台调度中访问或修改全局变量的代码



描述:

在iFIX中使用调度要后台运行的时候需要启动FixBackgroundServer程序,而该程序实际上是启动了独立于Workspace的进程,所以在后台调度中不能直接访问全局变量。下面的例子代码描述了怎样访问的方法:





" First get a pointer to the Application object in the Workspace

Dim WrkSpcApp As Object

Set WrkSpcApp = GetObject("", "Workspace.Application")



" Get a pointer to the Variable object called Variable 1 in the User globals

Dim TargetVar As Object

Set TargetVar = WrkSpcApp.Documents("User").Page.FindObject("Variable1")



" Set the current value in the variable object to a 1

TargetVar.CurrentValue = 1







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1