c# - ObjectForScripting with multiple Interfaces not working -


i have winform interacts webbrowsercontrol through objectforscripting. baseclass of winform not comvisible , can not or not change it. because there noncomvisiblebaseclass have created interface , set comvisible(true) , set formattribute [classinterface(classinterfacetype.none)]. methods in interface can called javascript. , works perfect:

//make class visible com can set objectforscripting //specify classinterfacetype.none use comvisible interface [comvisible(true)] [classinterface(classinterfacetype.none)] public partial class geekbrowser : geekbasepage, imapcontrolinteractable ... public class geekbasepage : system.windows.forms.form ... [comvisible(true)] public interface imapcontrolinteractable 

but problem. interface contains multiple functions. want separate interfaces separate task groupings. want interface contains logging functions , interface dataaccess functions , on.

so like:

[comvisible(true)] [classinterface(classinterfacetype.none)] public partial class geekbrowser : geekbasepage, idataaccess, ilogging ... public class geekbasepage : system.windows.forms.form ... [comvisible(true)] public interface idataaccess ... [comvisible(true)] public interface ilogging 

but when functions of second interface (ilogging) not accessible javascript. if switch order of interfaces idataaccess functions not accessible.

so seems case methods first interface accessible in javascript.

what can make every function of each interface accessible? once again, making baseclass comvisible , deleting classinterface attribute work not option.

thanks in advance!!

when doing similar project, found javascript able access default interface of generate com wrapper, in case picking first comvisible interface finds default one, since not explicitly setting default interface attribute. problem javascript has no queryinterface analogue.

to access other interfaces need create our own version of queryinterface javascript, either providing explicit cast-type function in default interface (not elegant) or having separate object can perform conversion correct comvisible interface type.

hope helps!


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -