在按钮中编辑VBA脚本 可以直接退出iFIX软件。

按钮代码:

 

 
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any)
Private Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
 
 
Private Sub CommandButton14_Click()
 Dim lResult As Long
    Dim iResult
    Dim hw&, cnt&
    'hw& = FindWindow(vbNullString, "iFix Startup") '注意:在有加密锁的状态,要用这句
    hw& = FindWindow(vbNullString, "iFix Startup - 演示方式")
    If hw& = 0 Then hw& = FindWindow(vbNullString, "iFix Startup")
    If hw& <> 0 Then cnt& = SendMessage(hw&, &H10, 0, 0&)
 
    Shell "shutdown -S -t 30" '延时30S 等待iFIX关闭后再关闭XP
End Sub