Tags Palabras claves

Probles accessing an ActiveX (C# based) from Internet Explorer (6,

28/04/2010 - 19:32 por womin | Informe spam
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

#1 Osvaldo Luis
28/04/2010 - 22:15 | Informe spam
ENGLISH


http://www.microsoft.com/communitie...sloc=en-us


http://www.microsoft.com/communitie...sloc=en-us


http://www.microsoft.com/communitie...sloc=en-us




Osvaldo L Vila.
Desde Burzaco-
Buenos Aires-
Argentina.

ATENCIÓN!!! EL VIRUS MAS DESTRUCTIVO ESTA ENTRE EL TECLADO Y LA SILLA.

SIEMPRE INFORMADO EN SEGURIDAD:
http://www.infospyware.com/blog
http://www.eset-la.com/link.php?i76
Estos programas de seguridad no deben faltar en tu equipo:
SuperAntiSpyware 4.26- Spyware Blaster 4.3- Spybot Search 1.6.2-
Malwarebytes' Anti-Malware 1.44- Ccleaner 2.30 y Disk Cleaner 1.5.7
Antivirus Nod32 (de pago) o AVIRA ANTIVIR PERSONAL Free Antivirus o Avats
5.0 o Avg 9.0 Gratuitos.




















"womin" escribió en el mensaje
news:
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.

Preguntas similares