等二次确认后,变量“zh1”赋值为1,wincc运行时只能运行一次脚本如下:{int ZW,i,j;ZW= MessageBox(NULL,"你确定启动吗?","警告",MB_YESNO|MB_SETFOREGROUND|MB_SYSTEMMODAL);if (ZW==IDYES){SetTagBit("zh1",1);for(i=0;i<60;i++) {for(j=0;j<60;j++) {} } SetTagBit("zh1",0);SetTagBit("i",0);SetTagBit("j",0);}else{} }
最佳答案
参考:
使用WinCC输入/输出域实现带确认的输入操作
https://support.industry.siemens.com/cs/cn/zh/view/78818232
提问者对于答案的评价:
已解决,c脚本如下#include "apdefap.h"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y)
{
#pragma option(mbcs);
#pragma code("Kernel32.dll");
void Sleep(int Milliseconds);
#pragma code()
int ZW,i;
ZW= MessageBox(NULL,"你确定启动吗?","警告",MB_YESNO|MB_SETFOREGROUND|MB_SYSTEMMODAL);
if (ZW==IDYES)
{SetTagBit("zh1",1);
Sleep(5000);
SetTagBit("zh1",0);}
else
{SetTagBit("zh1",0);
}
}
原创文章,作者:ximenziask,如若转载,请注明出处:https://www.zhaoplc.com/plc353715.html