C# Dlls in scripts - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: C# Dlls in scripts (/showthread.php?tid=64267) C# Dlls in scripts by Hilikus on 07-31-2006 at 04:21 AM
How do i call a function from a dll that was written in C#? interop.Call requires the name of the function, but in C# you have namespaces and everything is object oriented. Functions are not in a global or standard namespace as you could have in c++ so the second parameter of Call() should be what?? RE: C# Dlls in scripts by Mnjul on 07-31-2006 at 10:55 AM
You need to use regasm, which allows .net classes to be used like COM classes, to register your dll, and in your Javascript, just do this: RE: C# Dlls in scripts by Hilikus on 08-01-2006 at 02:00 AM oh ok, that worked out well after some research and testing but there is still one thing. activexObject calls the default constructor, what if i want to call a constructor with parameters?? any help would be appreciated since i havent been able to find anything RE: C# Dlls in scripts by Adeptus on 08-01-2006 at 02:58 AM
quote:Sorry, you can't. Classes instantiated through COM interop must have a default (public, parameterless) constructor. You should be able to easily work around this in most cases, by providing properties to set whatever you would have set through constructor's parameters. Where that isn't possible (you are using somebody else's class or it is essential to your logic to have the parameter passed at creation time), use a helper class with a public method which takes the parameters, creates the class instance passing parameters to the constructor, and returns the created object. |