Dear all,
I have developed an ActiveX from a user control written in C# using the
interoperability options of System.Runtime.InteropServices. The ActiveX must
then be accessed from JavaScript in Internet Explorer.
I have exposed the interface within the user control in the way that I have
found in the documentation:
[...]
/// <summary>
/// Interface that exposes the information accessible from outside the
user control
/// </summary>
[Guid("F2B547B9-605A-4f90-9090-1C69454B4BF0")]
public interface IExposedMembers
{
[DispId(1)]
string GetUri();
[DispId(2)]
void SetUri(string uri);
}
[...]
I implemented the IObjectSafety and gave a GUID to the main user control
class with [ComVisible(true)] and other needed things as the documentation
again.
Finally I signed the CAB and I try to access it from a simple HTML file with
JavaScript:
<OBJECT id="GPlayer" name="GPlayer"
CLASSID="CLSID:B8E60027-5F83-43b3-862D-9B427F13EE9E"
CODEBASE="/GPlayer/GPlayerDeployer.cab#version=1,0,0,0" width="556"
height="580"></OBJECT>
[...]
<script language="javascript">
{
function setValue()
{
try
{
alert( "Accessing GPlayer object" );
var objGPlayer = document.getElementById("GPlayer");
if (objGPlayer != "")
{
document.GPlayer.SetUri(frm.txtUri.value);
}
else
{
alert( "Failed: objGPlayer is null" );
}
}
catch(exception)
{
alert( "Failed: " + exception.description );
}
}
}
</script>
The problem is the following:
Neither in Internet Explorer 6, Internet Explorer 7 or Internet Explorer 8
the navigator crashes when I try to call the "SetUri()" method from the
ActiveX.
Anybody knows a solution? Some example that really works? Please, I am been
looking for a solution so many time and nothing works... :(
Thanks in advance.
Domingo.
Leer las respuestas