发表于:2008-03-15 09:28:00
楼主
如题:
#include "apdefap.h"
int gscAction( void )
{
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
#define TAG_0 "@NewConnection@AlternateConnectionAddress"
#define TAG_1 "@NewConnection@ConnectionEstablishMode"
#define TAG_2 "@NewConnection@ConnectionState"
#define TAG_3 "@NewConnection@ForceConnectionAddress"
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END
#pragma code("msrtcli.dll")
#include "msrtapi.h"
#pragma code()
#pragma code( "kernel32.dll" )
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime);
#pragma code()
static int Mld_Main = 0;
static int Mld_Res = 0;
DWORD ServiceID = 0;
static BOOL InitFirst = TRUE;
static MSG_RTCREATE_STRUCT MsgCreate;
CMN_ERROR Error;
if ( InitFirst == TRUE )
{
memset( &MsgCreate, 0, sizeof (MSG_RTCREATE_STRUCT) );
MsgCreate.dwMsgState = MSG_STATE_COME;
MsgCreate.wTextValueUsed = 1;
sprintf( MsgCreate.mtTextValue[0].szText, "NewConnection" );
SetTagChar( TAG_0, " " );
InitFirst = FALSE;
}
if ( GetTagDWordWait( TAG_1 ) == 0 )
{
Mld_Main = 0;
Mld_Res = 0;
return 0;
}
else
{
GetLocalTime( &MsgCreate.stMsgTime );
MSRTStartMsgService ( &ServiceID, NULL, NULL, MSG_NOTIFY_MASK_ARCHIV, NULL, &Error );
if ( GetTagDWordWait( TAG_2 ) == 0 )
{
if ( GetTagDWordWait( TAG_3 ) == 0 )
{
if ( Mld_Main == 0 )
{
MsgCreate.dwMsgNr = 1012222;
MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
Mld_Main = 1;
}
}
else
{
if ( Mld_Res == 0 )
{
MsgCreate.dwMsgNr = 1012224;
MSRTCreateMsg( ServiceID, &MsgCreate, &Error );
Mld_Res = 1;
}
}
if ( GetTagDWordWait( TAG_2 ) == 0 )
{
if ( GetTagDWordWait( TAG_3 ) == 0 )
{
SetTagDWord( TAG_3, 1 );
}
else
{
SetTagDWord( TAG_3, 0 );
}
}
}
else
{
if ( ( Mld_Main != 0 ) || ( Mld_Res != 0 ) )
{
Mld_Main = 0;
Mld_Res = 0;
if ( GetTagDWordWait( TAG_3 ) == 0 )