Applies To:
  • CitectSCADA 5.20

Summary:
When I call CTAPI with an Active X control it will cause Citect to hang. How can I use the CTAPI from an Active X control that I use in Citect?

Solution:
Calling CTAPI directly from an Active X control in Citect will cause a deadlock. The CTAPI has been designed for high performance asynchronous operation and has many functions which will block the caller. These operations cannot be called from an Active X control or you will block the primary Citect animation thread. When CTAPI blocks the primary Citect thread, this will cause a deadlock condition. This is because Citect is calling the Active X control and then the Active X control is calling back into Citect.

You may work around this problem by creating another thread in you Active X control which calls CTAPI. This way the secondary thread does all the blocking calls to the CTAPI and stores the results in global memory. The normal Active X draw code can pick up the results from global memory and display them in its control. By separating the slower, I/O bound operations into another thread, it keeps the animation of graphics pages fast.

This problem can also occur if you call CTAPI via the DLLCall() function

 

Keywords:
ActiveX 

Attachments