I added a WinCC OA panel using the GEDI tool and dropped an ActiveX control (built using .NET framework 2.0/ C#) onto the panel.
I then ran the WinCC OA panel in the QuickTest module and attempted to click on the ActiveX control and get the following exception thrown from the CLR library in .NET (mscorlib.dll).
[System.Runtime.InteropServices.COMException] = {"Invalid rectangle (Exception from HRESULT: 0x8004000D (OLE_E_INVALIDRECT))"}
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Windows.Forms.UnsafeNativeMethods.ThrowExceptionForHR(Int32 errorCode)
at System.Windows.Forms.Control.ActiveXImpl.InPlaceActivate(Int32 verb)
at System.Windows.Forms.Control.ActiveXImpl.OnFocus(Boolean focus)
at System.Windows.Forms.Control.ChildGotFocus(Control child)
at System.Windows.Forms.Control.ChildGotFocus(Control child)
at System.Windows.Forms.Control.OnGotFocus(EventArgs e)
at System.Windows.Forms.ButtonBase.OnGotFocus(EventArgs e)
at System.Windows.Forms.Control.WmSetFocus(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Then after some research I found that I can handle this COM exception by adding hook from the ActiveX control object initializer and caught the same using the application threading exception handler (see code below).
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
However this exception does not seem to cause any issues with the functionality of the application and the ActiveX control seems to be completely functional (except for this exception which gets thrown every time (first time) when the ActiveX control gets focused and goes out of focus and requires the user to click on continue if it is not handled).
Please let me know if there is any specific reason for this exception/effects if any and if it is expected to be handled in the application.
Could this be related to any security violation while accessing the Active X control object via COM object from the WinCC OA and something which needs to be set in the WinCC OA configuration or O/S for COM security?
Appreciate your response.
Problem accessing Active X controls within WinCCOA panel
Search
Re: Problem accessing Active X controls within WinCCOA panel
Hello,
the error-information referes to Windows.Forms-objects and to other parts of the operating system.
You could check if the ActiveX-object works in an other application without using WinCC OA, e.g. ActiveX-testcontainer utilities.
If you need further assistance please refer to your common WinCC OA support for the United States, mailto: support.america.automation@siemens.com.
Best Regards
Leopold Knipp
Senior Support Specialist
the error-information referes to Windows.Forms-objects and to other parts of the operating system.
You could check if the ActiveX-object works in an other application without using WinCC OA, e.g. ActiveX-testcontainer utilities.
If you need further assistance please refer to your common WinCC OA support for the United States, mailto: support.america.automation@siemens.com.
Best Regards
Leopold Knipp
Senior Support Specialist
Re: Problem accessing Active X controls within WinCCOA panel
The active X control works fine on other applications.
This is tested under ActiveX test container (within Visual studio) as well as within the Client Builder project of Factorylink.
This is tested under ActiveX test container (within Visual studio) as well as within the Client Builder project of Factorylink.
Re: Problem accessing Active X controls within WinCCOA panel
If you ever think about a project with Solaris or Linux please do not use .NET ActiveX. Use QT EWOs and you will be satisfied B)
Re: Problem accessing Active X controls within WinCCOA panel
In COM and therefore ActiveX several threading models are available. Further the DotNET threading models are not fully compatible with the COM models.
In the past I have problems with that, but I can't remember the error message.
Further it is important, that the COM provider and the COM host uses the same threading model.
In the past I have problems with that, but I can't remember the error message.
Further it is important, that the COM provider and the COM host uses the same threading model.