BOOL GetTagBitState(Tag Tag_Name, PDWORD lp_dwstate);
这个函数里面的Tag_Name要求是一个变量名,我想在脚本里面多次调用,请问Tag_Name这个参数能不能用中间变量来动态赋值啊,如果可以,那这个中间变量应该是什么类型的呢?谢谢!下面是帮组里的例子
{
DWORD dwstate;
BOOL bValue;
dwstate = 0xFFFFFFFF;
//Get the tag value
//dwstate is the tag state
bValue = GetTagBitStateWait("gs_tag_bit",&dwstate);
//Create a string which includes the tag value
if (bValue)
{
// User defined code if the
// value of the tag is true
...
}
else
{
// User defined code if the
// value of the tag is false
...
}
}
最佳答案
Tag_Name的格式是字符串
char *tn = "";
switch( .... )
{
case 1:
tn = "Tag_Name_1" ;
break;
case 2:
tn = "Tag_Name_2" ;
break;
.....
case n:
tn = "Tag_Name_n" ;
break;
}
bValue = GetTagBitStateWait(tn,&dwstate);
提问者对于答案的评价:
确实是字符串类型,已经证实了
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc263936.html