The Group functions may be used to pass
multiple areas to the Alarm functions simultaneously. The following
function demonstrates this. First, it creates a group that consists
of a list of numbers from 0 to 255. It then passes the group handle
to the AlarmxxxCatRec functions in place of the Area number. To
demonstrate that it worked, it logs some information about each
alarm found to the Citect Kernel Window. (Use the command
DspKernel(1) to display the Kernel.)
FUNCTION
AreaSearch()
INT iRec;
INT hGrp;
hGrp = GrpOpen("MyGrp", 1);
StrToGrp(hGrp, "0..255");
iRec = AlarmFirstCatRec(0, 0, hGrp);
WHILE iRec <> -1 DO
TraceMsg("Rec:" + iRec:# + " Alarm:" + AlarmGetFieldRec(iRec, "Tag", 0));
iRec = AlarmNextCatRec(iRec, 0, 0, hGrp);
END
GrpClose(hGrp);
END
|