Industry Online Support
Technical Forum
7/26/2007 10:08 PM | |
Posts: 3149 Rating:
|
Hi can you post a kind of testscript here?? Which WinCC version are you using? http://support.automation.siemens.com/WW/view/en/24325381 nemo |
7/26/2007 11:25 PM | |
Posts: 13 Rating:
|
Hi Nemo, Yeah I can, it's just complicated so I wanted to wait until I thought someone would read it. Anyhow I'm using VB6 and the DLL exports. I do the same thing as a similiar KB entry to what you provided, the one for 'any 6.0 WinCC': http://support.automation.siemens.com/WW/view/en/218555 The 'major' code is below, and the whole VB6 module with ported information from the C header is attached. Note it's almost identical to the KB entry above. When I call this, sometimes the comment is recorded with the alarm, and sometimes it isn't. I always get an alarm added to the long term archive. It's odd because I don't get consistent behavior. Thanks, Brandon ' Operator Message Number MsgCreate.dwMsgNr = MSG_SINGLE_OPERATION MsgComment.dwMsgNr = MSG_SINGLE_OPERATION ' Time GetLocalTime stTime MsgCreate.stMsgTime = stTime MsgComment.stTime = stTime ' Process Values to Use MsgCreate.wPValueUsed = 7 ' 3 Process Tags( 0..2 ) (flag bits) MsgCreate.dPValue(0) = 0 ' Tag-ID (doesn't work- sometimes ID goes in tag column, sometimes nothing; never tag name even though ID matches a tag MsgCreate.dPValue(1) = OldValue ' Form1.Text1 '99 ' Old Value MsgCreate.dPValue(2) = NewValue ' New Value ' State MsgCreate.dwMsgState = MSG_STATE_COME '; // state "COME" MsgCreate.dwFlags = 0 ' 15 ' Comments byteString Comment, MsgComment.szText ' comment text byteString WinCC_Interfacing.winccCurrentUser(), MsgComment.szUser ' GetTagChar("@CurrentUser" byteString Audit_Interfacing.doGetComputerName(), MsgComment.szComputerName byteString "iQuest IO Field", MsgComment.szApplicationName ' Connect to MS RT fRet = MSRTStartMsgService(myID, ByVal 0&, ByVal 0&, ByVal 0&, ByVal 0&, myErrors) '; // activate service If fRet = 0 Then Exit Function ' ie WinCC is not open, alarm logging not enabled, etc. ' Make message fRet = MSRTCreateMsg(myID, MsgCreate, myErrors) If fRet <> 0 Then ' Alarm created! fRet = MSRTSetComment(myID, MsgComment, myErrors) If fRet = 1 Then ' Total Success End If End If fRet = MSRTStopMsgService(myID, myErrors) '; // cancel service AttachmentWinCC_MS_Interfacing.zip (47 Downloads) |
Follow us on