📄 iopcdllloader.pas
字号:
@RawOPCDLLSignalGetGroupHandle := GetProcAddress(OPCManagerDLLHandle, 'SignalGetGroupHandle');
@RawOPCDLLSignalSendData := GetProcAddress(OPCManagerDLLHandle, 'SignalSendData');
@RawOPCDLLEditorSessionStart := GetProcAddress(OPCManagerDLLHandle, 'EditorSessionStart');
@RawOPCDLLEditorSessionStop := GetProcAddress(OPCManagerDLLHandle, 'EditorSessionStop');
@RawOPCDLLEditorComputerBranchOpen := GetProcAddress(OPCManagerDLLHandle, 'EditorComputerBranchOpen');
@RawOPCDLLEditorComputerBranchClose := GetProcAddress(OPCManagerDLLHandle, 'EditorComputerBranchClose');
@RawOPCDLLEditorComputerBranchGetItemCount := GetProcAddress(OPCManagerDLLHandle, 'EditorComputerBranchGetItemCount');
@RawOPCDLLEditorComputerBranchGetItemData := GetProcAddress(OPCManagerDLLHandle, 'EditorComputerBranchGetItemData');
@RawOPCDLLEditorServerSetup := GetProcAddress(OPCManagerDLLHandle, 'EditorServerSetup');
@RawOPCDLLEditorServerGetCount := GetProcAddress(OPCManagerDLLHandle, 'EditorServerGetCount');
@RawOPCDLLEditorServerGetData := GetProcAddress(OPCManagerDLLHandle, 'EditorServerGetData');
@RawOPCDLLEditorItemSetup := GetProcAddress(OPCManagerDLLHandle, 'EditorItemSetup');
@RawOPCDLLEditorItemGetBrowseType := GetProcAddress(OPCManagerDLLHandle, 'EditorItemGetBrowseType');
@RawOPCDLLEditorItemSetPath := GetProcAddress(OPCManagerDLLHandle, 'EditorItemSetPath');
@RawOPCDLLEditorItemGetBranchItems := GetProcAddress(OPCManagerDLLHandle, 'EditorItemGetBranchItems');
@RawOPCDLLEditorItemGetQualifiedName := GetProcAddress(OPCManagerDLLHandle, 'EditorItemGetQualifiedName');
@RawOPCDLLGroupAdd := GetProcAddress(OPCManagerDLLHandle, 'GroupAdd');
@RawOPCDLLGroupDelete := GetProcAddress(OPCManagerDLLHandle, 'GroupDelete');
@RawOPCDLLGroupResume := GetProcAddress(OPCManagerDLLHandle, 'GroupResume');
@RawOPCDLLGroupSuspend := GetProcAddress(OPCManagerDLLHandle, 'GroupSuspend');
@RawOPCDLLGroupGetCount := GetProcAddress(OPCManagerDLLHandle, 'GroupGetCount');
@RawOPCDLLGroupGetHandleByName := GetProcAddress(OPCManagerDLLHandle, 'GroupGetHandleByName');
@RawOPCDLLGroupGetName := GetProcAddress(OPCManagerDLLHandle, 'GroupGetName');
@RawOPCDLLGroupGetComputerName := GetProcAddress(OPCManagerDLLHandle, 'GroupGetComputerName');
@RawOPCDLLGroupGetOPCServerName := GetProcAddress(OPCManagerDLLHandle, 'GroupGetOPCServerName');
@RawOPCDLLGroupGetUpdateRate := GetProcAddress(OPCManagerDLLHandle, 'GroupGetUpdateRate');
@RawOPCDLLGroupSetUpdateRate := GetProcAddress(OPCManagerDLLHandle, 'GroupSetUpdateRate');
@RawOPCDLLGroupGetHandle := GetProcAddress(OPCManagerDLLHandle, 'GroupGetHandle');
@RawOPCDLLServerConnectionGetCount := GetProcAddress(OPCManagerDLLHandle, 'ServerConnectionGetCount');
@RawOPCDLLServerConnectionGetName := GetProcAddress(OPCManagerDLLHandle, 'ServerConnectionGetName');
@RawOPCDLLServerConnectionGetGroupCount := GetProcAddress(OPCManagerDLLHandle, 'ServerConnectionGetGroupCount');
@RawOPCDLLServerConnectionGetGroupName := GetProcAddress(OPCManagerDLLHandle, 'ServerConnectionGetGroupName');
@RawOPCDLLServerConnectionReconnect := GetProcAddress(OPCManagerDLLHandle, 'ServerConnectionReconnect');
@RawOPCDLLServerConnectionDisconnect := GetProcAddress(OPCManagerDLLHandle, 'ServerConnectionDisconnect');
@RawOPCDLLManagerCreated := GetProcAddress(OPCManagerDLLHandle, 'ManagerCreated');
@RawOPCDLLManagerAddItem := GetProcAddress(OPCManagerDLLHandle, 'ManagerAddItem');
@RawOPCDLLManagerDestroyed := GetProcAddress(OPCManagerDLLHandle, 'ManagerDestroyed');
@RawOPCDLLIsEvaluation := GetProcAddress(OPCManagerDLLHandle, 'IsEvaluation');
end;
//******************************************************************************
procedure DoDLLCheck;
begin
if not OPCDLLLoaded then raise Exception.Create('Iocomp OPC DLL Not Found.');
end;
//******************************************************************************
procedure RaiseFunctionNotFoundException(FunctionName: String);
begin
raise Exception.Create('Function "' + FunctionName + '" not found in "' + OPCMANAGERDLLSTRINGRESOURCE + '".');
end;
//******************************************************************************
function OPCDLLSignalAdd(ComputerName, OPCServerName, ItemName, GroupName: PChar; UpdateRate: Integer; Suspend: Boolean; DataType: TiTypeKind; CallBackMethod: TOPCDLLNewData): Integer;
begin
DoDLLCheck;
if not Assigned(@RawOPCDLLSignalAdd) then RaiseFunctionNotFoundException('SignalAdd');
Result := RawOPCDLLSignalAdd(ComputerName, OPCServerName, ItemName, GroupName, UpdateRate, Suspend, DataType, CallBackMethod);
end;
//******************************************************************************
procedure OPCDLLSignalRemove(SignalHandle: Integer);
begin
DoDLLCheck;
if not Assigned(@RawOPCDLLSignalRemove) then RaiseFunctionNotFoundException('SignalRemove');
RawOPCDLLSignalRemove(SignalHandle);
end;
//******************************************************************************
procedure OPCDLLSignalSuspend(SignalHandle: Integer);
begin
DoDLLCheck;
if not Assigned(@RawOPCDLLSignalSuspend) then RaiseFunctionNotFoundException('SignalSuspend');
RawOPCDLLSignalSuspend(SignalHandle);
end;
//******************************************************************************
procedure OPCDLLSignalResume(SignalHandle: Integer);
begin
DoDLLCheck;
if not Assigned(@RawOPCDLLSignalResume) then RaiseFunctionNotFoundException('SignalResume');
RawOPCDLLSignalResume(SignalHandle);
end;
//******************************************************************************
function OPCDLLSignalGetActive(SignalHandle: Integer): Boolean;
begin
DoDLLCheck;
if not Assigned(@RawOPCDLLSignalGetActive) then RaiseFunctionNotFoundException('SignalGetActive');
Result := RawOPCDLLSignalGetActive(SignalHandle);
end;
//******************************************************************************
function OPCDLLSignalGetGroupHandle(SignalHandle: Integer): Integer;
begin
DoDLLCheck;
if not Assigned(@RawOPCDLLSignalGetGroupHandle) then RaiseFunctionNotFoundException('SignalGetGroupHandle');
Result := RawOPCDLLSignalGetGroupHandle(SignalHandle);
end;
//******************************************************************************
procedure OPCDLLSignalSendData(SignalHandle: Integer; Data: OLEVariant);
begin
DoDLLCheck;
if not Assigned(@RawOPCDLLSignalSendData) then RaiseFunctionNotFoundException('SignalSendData');
RawOPCDLLSignalSendData(SignalHandle, Data);
end;
//******************************************************************************
function OPCDLLEditorSessionStart: Integer;
begin
Result := -1;
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorSessionStart) then Exit;
Result := RawOPCDLLEditorSessionStart;
end;
//******************************************************************************
procedure OPCDLLEditorSessionStop(SessionHandle: Integer);
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorSessionStop) then Exit;
RawOPCDLLEditorSessionStop(SessionHandle);
end;
//******************************************************************************
procedure OPCDLLEditorComputerBranchOpen(SessionHandle: Integer; NetResource: TiNetData);
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorComputerBranchOpen) then Exit;
RawOPCDLLEditorComputerBranchOpen(SessionHandle, NetResource);
end;
//******************************************************************************
procedure OPCDLLEditorComputerBranchClose(SessionHandle: Integer);
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorComputerBranchClose) then Exit;
RawOPCDLLEditorComputerBranchClose(SessionHandle);
end;
//******************************************************************************
function OPCDLLEditorComputerBranchGetItemCount(SessionHandle: Integer): Integer;
begin
Result := 0;
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorComputerBranchGetItemCount) then Exit;
Result := RawOPCDLLEditorComputerBranchGetItemCount(SessionHandle);
end;
//******************************************************************************
function OPCDLLEditorComputerBranchGetItemData (SessionHandle: Integer; Index: Integer): TiNetData;
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorComputerBranchGetItemData) then Exit;
Result := RawOPCDLLEditorComputerBranchGetItemData(SessionHandle, Index);
end;
//******************************************************************************
procedure OPCDLLEditorServerSetup(SessionHandle: Integer; MachineName: PChar);
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorServerSetup) then Exit;
RawOPCDLLEditorServerSetup(SessionHandle, MachineName);
end;
//******************************************************************************
function OPCDLLEditorServerGetCount(SessionHandle: Integer): Integer;
begin
Result := 0;
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorServerGetCount) then Exit;
Result := RawOPCDLLEditorServerGetCount(SessionHandle);
end;
//******************************************************************************
function OPCDLLEditorServerGetData(SessionHandle: Integer; Index: Integer): TiServerData;
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorServerGetData) then Exit;
Result := RawOPCDLLEditorServerGetData(SessionHandle, Index);
end;
//******************************************************************************
procedure OPCDLLEditorItemSetup(SessionHandle: Integer; MachineName, OPCServerName: PChar);
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorItemSetup) then Exit;
RawOPCDLLEditorItemSetup(SessionHandle, MachineName, OPCServerName);
end;
//******************************************************************************
function OPCDLLEditorItemGetBrowseType(SessionHandle: Integer): TiNameSpaceType;
begin
Result := instFlat;
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorItemGetBrowseType) then Exit;
Result := RawOPCDLLEditorItemGetBrowseType(SessionHandle);
end;
//******************************************************************************
procedure OPCDLLEditorItemSetPath(SessionHandle: Integer; Path: PChar);
begin
if not OPCDLLLoaded then Exit;
if not Assigned(@RawOPCDLLEditorItemSetPath) then Exit;
RawOPCDLLEditorItemSetPath(SessionHandle, Path);
end;
//******************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -