iFix的n个经典问题解答 点击:894 | 回复:1



cqs0088

    
  • 精华:13帖
  • 求助:0帖
  • 帖子:1879帖 | 39回
  • 年度积分:0
  • 历史总积分:0
  • 注册:1900年1月01日
发表于:2009-01-06 07:48:22
楼主
1:iFIX中如何使用vba开启和停止wsqlodc和alarmsODBC?

Description

The ability to stop or start the SQL task, wsqlodc, and to pause or continue the alarms to
ODBC task used to only be available by launching Mission Control and manually controlling them.

The ability to perform this control programmatically using VBA was added as part of a SIM for
iFix 2.5. The function calls to allow this are not widely documented and are shown below: -

Resolution

Declare Function TurnOnSqlTask Lib "missionvba" (ByVal cmd$) As Long

‘Turns on a SQL task. The cmd$ parameter is the command line passed to the SQL task
‘Return of 0 is a success. Current logged in user must have security rights to turn
‘on/off SAC. If a non-zero error code is returned, you can use the err2str
‘utility in the fix base directory to translate the error to a string

Declare Function TurnOffSqlTask Lib "missionvba" () As Long

‘Turns off a SQL task. Return of 0 is a success. Current logged in user must
‘have security rights to turn on/off SAC. If a non-zero error code is returned,
‘you can use the err2str utility in the fix base directory to translate the error to a string

Declare Function PauseAlarmODBC Lib "missionvba" () As Long

‘Pauses the AlarmODBC task. Return of 0 is a success. Current logged in user does NOT
‘have to have security rights.

‘This function will execute regardless of the "Allow Operator to Pause Alarm Logging"
‘Setting found in the iFIX ODBC Alarm Service Configurator of the System Configuration
‘Utility.

PrivatedeclareFunction ContinueAlarmODBC Lib "missionvba" () As Long

‘Resumes the AlarmODBC task. Return of 0 is a success. Current logged in user does NOT
‘have to have security rights.

‘This function will execute regardless of the "Allow Operator to Pause Alarm Logging"
‘Setting found in the iFIX ODBC Alarm Service Configurator of the System Configuration
‘Utility.

‘All of these functions will block until the request is completed.

2:iFIX如何使用vba开启和停止基于时间和事件的调度?

Description:This solution shows how to start and stop a time-based or event-based schedule
running in the background.
Resolution:STOP / START a EVENT BASED SCHEDULE
To Start:
Private Sub CommandButton1_Click()
Dim Var1 As Object
Dim Var2 As Object

Set Var1 = GetObject(, "FixBackGroundServer.Application")
Set Var2 = Var1.System.FindObject("SchedTest1.FIXEvent1")

Var2.StartEvent
End Sub

To Stop:

Private Sub CommandButton1_Click()
Dim Var1 As Object
Dim Var2 As Object

Set Var1 = GetObject(, "FixBackGroundServer.Application")
Set Var2 = Var1.System.FindObject("SchedTest1.FIXEvent1")

Var2.StopEvent
End Sub

STOP / START a TIME BASED SCHEDULE

To Stop the TimerObject:

Private Sub CommandButton1_Click()
Dim Var1 As Object
Dim Var2 As Object

Set Var1 = GetObject (,"FixBackGroundServer.Application")
Set Var2 = Var1.System.FindObject("Sched1.Timer1")

Var2.TimerEnabled = False

End Sub

To Start the TimerObject:

Private Sub CommandButton2_Click()
Dim Var1 As Object
Dim Var2 As Object

Set Var1 = GetObject (,"FixBackGroundServer.Application")
Set Var2 = Var1.System.FindObject("sched.Timer1")

Var2.TimerEnabled = True
Var2



人在世上飘

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 72回
  • 年度积分:0
  • 历史总积分:308
  • 注册:2008年6月18日
发表于:2009-02-25 16:14:51
1楼

收藏了,谢谢了。。。。。。。。。。。


热门招聘
相关主题

官方公众号

智造工程师