Applies To:
  • CitectSCADA 6.00 Service Pack A

Summary:
I would like to create an ActiveX control that integrates into CitectSCADA and allows me to detect settings like security and language. What do I need to know?
 

Solution:
This CitectSCADA Knowledge Base article assumes the reader is very familiar with COM and ActiveX. It is beyond the scope of this article to explain ActiveX concepts. For more details please refer to the Microsoft Developer Network.

CitectSCADA Knowledge Base article Q3876 “Common Questions about ActiveX Controls in CitectSCADA” covers the most common questions about using ActiveX controls in CitectSCADA. Article Q3876 should be read before reading this article.

Ambient Properties

The CitectSCADA Runtime ActiveX container exposes a number of custom ambient properties. The DSPIDs of the properties is as follows:

DSPID

Type

Property

366

UI1

User Privilege Level (0-255)

367

BSTR

Language Path

368

UI1

Citect Mode
0 = Normal Mode

1 =
Internet Client

369

BSTR

Project Path, same as [CTEDIT]RUN

370

UI4

Native Codepage

In addition CitectSCADA also supports the following ‘standard’ ambient properties as defined in <olectl.h>:

DSPID

DISPID_AMBIENT_BACKCOLOR

DISPID_AMBIENT_FORECOLOR

DISPID_AMBIENT_LOCALEID

DISPID_AMBIENT_MESSAGEREFLECT

DISPID_AMBIENT_USERMODE

DISPID_AMBIENT_UIDEAD

DISPID_AMBIENT_SHOWGRABHANDLES

DISPID_AMBIENT_SHOWHATCHING

DISPID_AMBIENT_DISPLAYASDEFAULT

DISPID_AMBIENT_SUPPORTSMNEMONICS

DISPID_AMBIENT_AUTOCLIP

DISPID_AMBIENT_APPEARANCE

DISPID_AMBIENT_FONT

DISPID_Name

Connection Point Events

The CitectSCADA Runtime ActiveX container will query all ActiveX controls for an IConnectionPointContainer interface and then subscribe to all IConnectionPoint interfaces. This is used to allow the runtime to detect events from controls, allowing event handlers to be written.

The CitectSCADA Runtime ActiveX container also exposes an IConnectionPointContainer interface and an IConnectionPoint (ISecurityEventSink ) to allow notification of security context changes to controls. When a user is logged into or out of CitectSCADA all subscribed controls will have the OnSecurityContextChange() method called to notify them that they need to refresh the user privilege information obtained from the ambient properties.

The ISecurityEventSink interface is defined in the following fragment of IDL code:

[
    
uuid(4530A13D-A24F-4ebb-BCC9-C1F6A07BC963), 
    
helpstring("CitectActiveX 1.0 Type Library"), 
    
version(1.0)
]
library CitectAcitveX

    
import "oaidl.idl";
    
import "ocidl.idl";
    
[ object,
        
uuid(47057824-B1AD-4fcd-AF7D-6512EC49BA12),
        
helpstring("ISecurityEventSink Interface"),
        
version(1.0)
    
]
    
interface ISecurityEventSink : IUnknown
    
{
        
HRESULT OnSecurityContextChange();
    
}

}

 

Keywords:
ActiveX control container event connection point ambient properties background colour  

Attachments