I'm trying to use an ActiveX control in an out-of-browser Silverlight5 application.
This code (for in-browser) works:
Host Html page:
<script type="text/javascript">
function GetAXObjectStatus() {
var axObject = document.getElementById("axObject");
return axObject != null ? axObject.GetStatus() : -1;
}
</script>
</head>
<body>
<object id="axObject" classid="CLSID:my-cls-id"></object>
Silverlight:
string result = HtmlPage.Window.Invoke("GetAXObjectStatus").ToString(); // works fine
But the following (for out-of-borwser), which is my goal, doesn't work:
// Application.Current.HasElevatedPermissions == true
// AutomationFactory.IsAvailable == true
dynamic axObject = AutomationFactory.CreateObject("my_prog_id"); // returns a non-null object
axObject.GetStatus(); // produces a "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
Any idea what might be wrong?