dOPC Client Toolkit
Close
dOPCDA.TdOPCItems.OPCAddItems

OPCAddItems is intended to provide the mechanism to add multiple items to the TdOPCDAClient with one call to reduce the DCOM and XML calls.

function OPCAddItems(ItemList: TdOPCItemList; aAdd: boolean = true): boolean;
__fastcall boolean OPCAddItems(TdOPCItemList ItemList, boolean aAdd = true);

The result will be True on successful execution, otherwise False.

procedure AddItems(G: TdOPCGroup; ItemNames: TStrings); var IL : TdOPCItemList; Item : TdOPCItem; i : Integer; begin IL := TdOPCItemList.create; for i := 0 to ItemNames.Count-1 do begin Item := TdOPCItem(G.OPCItems.Add); Item.ItemID := ItemNames[i]; IL.Add(Item); end; G.OPCItems.OPCAddItems(IL); for i := 0 to IL.Count-1 do if IL[i].LastError <> S_OK then Beep; IL.Free; end; procedure TForm1.Button1Click(Sender: TObject); var Itemlist: TStringlist; MyGroup : tdOPCGroup; begin Itemlist := TStringlist.Create; Itemlist.Add('Random.String'); Itemlist.Add('Random.Int1'); Itemlist.Add('Random.NoExists'); MyGroup := dOPCServer1.OPCGroups.Add('MyGroup'); AddItems(MyGroup, Itemlist); Itemlist.Free; end;
Kassl GmbH Copyright © 2024. All rights reserved.