wincc 报警 C脚本

在自己笔记本上wincc 全局脚本中新建以下程序,变量满足条件这么没声音,现场拷贝过来的,我自己建了内部变量a测试,不行!请帮我做个测试吧。
MSG_RTDATA_STRUCT mRT;
int i;
char* pszToken;
//Now is my code
#pragma code("Winmm.dll")
BOOL WINAPI sndPlaySoundA(char* szWave,DWORD dwFlag);
#pragma code()
DWORD SND_ASYNC=0x0001;
DWORD SND_LOOP=0x0008;
DWORD alarmsum,alarmunack;
LPCMN_ERROR errorunack,errorsum;
#pragma code("msrtcli.dll")
#pragma code()
LPDWORD lpdwServiceID;

MSG_SERVICE_NOTIFY_PROC lpfnNotifyProc;

LPMSG_FILTER_STRUCT lpMsgFilter;

DWORD dwNotifyMask;

LPVOID lpvUser;

LPCMN_ERROR lpError;

BOOL n1;
MSRTGetMsgQuit(&alarmunack,errorunack);

SetTagDWord("number",alarmunack);

MSRTGetMsgActual(&alarmsum,errorsum);

SetTagDWord("sum",alarmsum);

if (alarmsum==0)

sndPlaySoundA(NULL,SND_ASYNC);

else

{

if (GetTagFloat("PumpLevelY.Value")>7.1)


sndPlaySoundA("D:\\SXWSN\\Sound\\Sound2.WAV",SND_ASYNC|SND_LOOP);

else

sndPlaySoundA(NULL,SND_ASYNC);

}
return 1;

最佳答案

#include "apdefap.h"
int gscAction( void )
{
#pragma code("Winmm.dll")
void WINAPI PlaySoundA(char* pszSound ,char* hmode,DWORD dwFlag);
#pragma code()
 DWORD A1,A2,A3,A4,A5,A6,A7;
 DWORD B1,B2,B3,B4,B5,B6,B7;
A1=GetTagDWord("YQ_ALARM_1");
A2=GetTagDWord("YQ_ALARM_2");
A3=GetTagDWord("YQ_ALARM_3");
A4=GetTagDWord("YQ_ALARM_4");
A5=GetTagDWord("YQ_ALARM_5");
A6=GetTagDWord("YQ_ALARM_6");
A7=GetTagDWord("COMM_ALARM");
B1=GetTagDWord("YQ_ALARM_SAVE_1");
B2=GetTagDWord("YQ_ALARM_SAVE_2");
B3=GetTagDWord("YQ_ALARM_SAVE_3");
B4=GetTagDWord("YQ_ALARM_SAVE_4");
B5=GetTagDWord("YQ_ALARM_SAVE_5");
B6=GetTagDWord("YQ_ALARM_SAVE_6");
B7=GetTagDWord("COMM_ALARM_SAVE");
if(
 ((A1^B1)&A1)|
 ((A2^B2)&A2)|
 ((A3^B3)&A3)|
 ((A4^B4)&A4)|
 ((A5^B5)&A5)|
 ((A6^B6)&A6)|
 ((A7^B7)&A7)
)
SetTagBit("yq_alarm_out",1);
if (GetTagBit("yq_alarm_out"))
PlaySoundA("c:\\winnt\\Media\\chord.wav",NULL,1);
SetTagDWord("YQ_ALARM_SAVE_1",A1);
SetTagDWord("YQ_ALARM_SAVE_2",A2);
SetTagDWord("YQ_ALARM_SAVE_3",A3);
SetTagDWord("YQ_ALARM_SAVE_4",A4);
SetTagDWord("YQ_ALARM_SAVE_5",A5);
SetTagDWord("YQ_ALARM_SAVE_6",A6);
SetTagDWord("COMM_ALARM_SAVE",A7);
return 0; 
}
用这个

提问者对于答案的评价:
谢谢啊

原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc255796.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2019年6月10日
下一篇 2019年6月10日

相关推荐