HOOK Functions, Basics
Two types of HOOK Functions are available in the Standard Object Library: Project HOOK Functions and Library HOOK Functions.
You can find the script stdlib_hook.ctl in the sub project directory \scripts\libs of the Stdlib. This script must be available in every WinCC OA Library project since it contains default settings! The script stdlib_hook.ctl contains the Library HOOK functions. The script stdlib_hook_project.ctl again contains the Project HOOK functions.
The code in these scripts is the default implementation. In order to overwrite the functions, complete the following steps:
-
Copy and save the file stdlib_hook.ctl in the new WinCC OA Library project directory under \scripts\libs.
-
Rename it by saving it under <<library name in small letters>_hook.ctl (e.g."gas_hook.ctl"). Note that the <wincc_oa_library_projectname> must be written in lower case letters irrespective of the name of the library project, e.g. not "hook_MyLib_" but "hook_mylib_".
-
Open the script in the WinCC OA script editor.
-
Use the script editors find and replace function to change all found strings hook_stdlib_ to hook_<winccoa_library_projectname>_. Note that the <wincc_oa_library_projectname> must be written in lower case letters irrespective of the name of the library project, e.g. not "hook_MyLib_" but "hook_mylib_".
-
Save the changes.
-
Now you change the implementation of the functions according to your needs. See Library HOOK-Functions andProject HOOK-Functions.