[aus-dotnet] Calling back to JScript from an IE-hosted Winforms Control?


    [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
    • From: Douglas Stockwell
    • Subject: [aus-dotnet] Calling back to JScript from an IE-hosted Winforms Control?
    • Date: Thu, 27 Oct 2005 12:23:01 +1000

    I’m hosting Windows Forms Controls in IE. I want to call back to JScript functions defined in the document to make changes elsewhere when state changes in the control. I can easily call from JScript to my control, but I haven’t been able to find a way to call back or propagate events from my control (when running with the Internet Permission Set).

     

    According to this article (http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx) it’s possible to do by defining a new COM IDispatch interface and having IE sink that – but that requires permissions to execute unmanaged code.

     

    I can pass JScript objects and functions into the control – where they show up as generic COMObject’s. Theoretically I could use IDispatch against these (obj.GetType().InvokeMethod(…)) but once again I don’t have permission to do that.

     

    I can pass document elements to the control – these show up as Microsoft.mshtml (GAC assembly) members – but I can’t talk to these either because Microsoft.mshtml doesn’t have AllowPartiallyTrustedCallers set.

     

    At the moment I have a workaround where some JScript code polls my control for changes – but this is a hack and pretty undesirable (I don’t want to do busy waiting but I want the results immediately).

     

    Any ideas?

     

    - Doug




    (Click here for more information on the aus-dotnet mailling list)