dOPC Client Toolkit Help file
dOPC.ProcessdOPCMessages Function
C++
ProcessdOPCMessages();
C#
ProcessdOPCMessages();
Visual Basic
Sub ProcessdOPCMessages()

dOPC

Call this procedure in a thread, to process dOPC OnDatachange events You can also use Application.ProcessMessages 

call this procedure in a thread, to process dOPC OnDatachange events 

ProcessdOPCMessages is used in threads to process OnDatachange events.

You can also use Application.ProcessMessages. 

 

procedure TOPCThread.Execute;
var
  G    : TdOPCGroup;
begin
  CoInitialize(nil);                         // !!!!!!!!!!!!!
  OPCServer:=TdOpcServer.Create(nil);
  try
    OPCServer.ServerName  := OpcServerName;
    OPCServer.ComputerName:= OpcComputerName;
    G := OPCServer.OPCGroups.Add('test');   // make a new group
    OPCServer.OnDatachange := OnDataChange;
    G.UpdateRate := 5000;
    G.OPCItems.AddItem('Random.String');    // add new Item to group
    OPCServer.Active := true;
    repeat
       ProcessdOPCMessages;     // !! to get OnDatachange event
       sleep(G.UpdateRate div 2);
    until Terminated;
  finally
    OPCServer.Free;
    CoUninitialize;                        // !!!!!!!!!!!!!
  end;
end;
What do you think about this topic? Send feedback!
Copyright © 2001-2014 Kassl GmbH (http://www.kassl.de). All rights reserved.