以下是脚本,请高手指点是否有错误,经常导致wincc画面异常,删除此全局脚本后,画面运行正常,谢谢!
#include "apdefap.h"
int gscAction( void )
{
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 dwNotityMask;
LPVOID lpvUser;
LPCMN_ERROR lpError;
BOOL n1;
n1=MSRTGetMsgQuit(&alarmunack,errorunack);
SetTagDWord("number",alarmunack);
MSRTGetMsgActual(&alarmsum,errorsum);
SetTagDWord("sum",alarmsum);
if (alarmsum==0)
sndPlaySoundA(NULL,SND_ASYNC);
else
{
if (alarmunack>0)
sndPlaySoundA("D:\\Horn_Attention.WAV",SND_ASYNC|SND_LOOP);
else
sndPlaySoundA(NULL,SND_ASYNC);
// sndPlaySoundA("D:Horn_Attention.WAV",SND_ASYNC|SND_LOOP);
}
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END
return 1;
}
最佳答案
直接用wincc自带的过程组建horn吧,这个组态简单,而且不耗费wincc资源
http://www.ad.siemens.com.cn/download/docMessage.aspx?Id=2580&
视频:
WinCC跟我做:WinCC实现声音报警的方法
http://www.ad.siemens.com.cn/Service/elearning/cn/Course.aspx?CourseID=892&
提问者对于答案的评价:
简单实用
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc216600.html