InsertAuditEntryNew

Function InsertAuditEntryNew(strOldValue, strNewValue, strOpComments, iComment) 
    
     
    ' WinCC Audit Scripting PlugIn Instance
    Dim objWinCCAuditPlugIn
    
    'Obtain the Audit PlugIn
    Set objWinCCAuditPlugIn = CreateObject("CCAuditCollector.CCAuditScriptPlugIn.1")
    
    If (Not (objWinCCAuditPlugIn Is Nothing))  Then
        
        
        Dim objAuditTag
        Set objAuditTag = Nothing 
        
        Dim strTargetName 
        Dim strApplicationUser
        Dim strAuditType
        
        Dim strReturnBuffer
        
        Set objAuditTag = HMIRuntime.Tags("@local::@CurrentUser")
        strApplicationUser = objAuditTag.Read()
        If (Len(strApplicationUser) = 0) Then
            strApplicationUser = "NOT_LOGGED_ON"
        End If
        
        strTargetName = "VBScripting Runtime"
        strAuditType = "OA"
        
        Dim currentLang 
        currentLang = HMIRuntime.Language
        
        objWinCCAuditPlugIn.SetCurrentLanguage(currentLang)
    
        Call objWinCCAuditPlugIn.InsertEntry(strApplicationUser, _
                                                            0, _ 
                                                            strTargetName, _
                                                            strOldValue, _ 
                                                            strNewValue, _
                                                            0, _ 
                                                            iComment, _
                                                            strOpComments, _					
                                                            strAuditType) 
    
    Else
        HMIRuntime.Traces(err.Description)
    End If

    'Release the Audit PlugIn 
    Set objWinCCAuditPlugIn = Nothing

    InsertAuditEntryNew = err.Description
    HMIRuntime.Trace(err.Description)
    
    
End Function

  

原文地址:https://www.cnblogs.com/yada/p/13821116.html