Shoutbox

[Solved] Call a DLL with javascript without Interop.Call - 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: [Solved] Call a DLL with javascript without Interop.Call (/showthread.php?tid=70039)

[Solved] Call a DLL with javascript without Interop.Call by Huhu_Manix on 12-29-2006 at 08:05 PM

Hi all !

I've programmed a little application in C# to use script like msg plus does.
I thank that was easy but there's a little problem. ^^

The application compil perfectly the JScript file, all work perfectly, I can call JS's function by the application, but I can't call application's function by the JS, i tried lot of thing as "Interop.Call" to send message with user32 but i understood after that's a msg plus function. :^)

Does someone know how i can call user32 without Interop.Call from the javascript's file ?

Maybe with an ActiveX object... *-)

I'm sure it's possible because Patchou did it.

Thanks ^^


RE: Call a DLL with javascript without Interop.Call by Baggins on 12-29-2006 at 08:12 PM

found this little snippet:

http://www.adp-gmbh.ch/csharp/call_dll.html


RE: Call a DLL with javascript without Interop.Call by Huhu_Manix on 12-29-2006 at 08:16 PM

Thanks but i meaned call a DLL from the JavaScript.


RE: Call a DLL with javascript without Interop.Call by Baggins on 12-29-2006 at 08:22 PM

Oh, i belive this is not possible because all variables in JScript are variants and it would not work with the arguments being of different, however, you can get a dynamic wrapper (ActiveX) .dll which takes the variants and passes them onto the requested function in the correct type.

i will update this when i find it

dnwrap.dll + readme.txt


RE: Call a DLL with javascript without Interop.Call by Huhu_Manix on 12-30-2006 at 03:00 AM

Thanks, i don't try it yet but it should be perfect ! ;)


RE: Call a DLL with javascript without Interop.Call by CookieRevised on 12-30-2006 at 03:15 AM

What Patchou did is adding his own methods, functions, interface, etc to the scripting engine. This should be well explained how in the MSDN library.


RE: Call a DLL with javascript without Interop.Call by Huhu_Manix on 12-30-2006 at 03:31 AM

Thanks but i tried what baggins gave me, it's exactly what i needed.


RE: [Solved] Call a DLL with javascript without Interop.Call by CookieRevised on 12-30-2006 at 09:10 AM

quote:
Originally posted by Huhu_Manix
Thanks but i tried what baggins gave me, it's exactly what i needed.
it works, but it is not what you need.

If you already included the Windows scripting engine so your applications acts as the host* , it is only a few steps away (relativly spoken) to make your own function and methods. You don't need to depend on a dodgy ActiveX wrapper for that.

*(and I hope you did and you do not do some dodgy thing as in pushing a text file to the scripting runtime with a call like Shell or whatever. As that would also mean your application has no scripting capabilities at all and isn't a host at all, you just take some script file and run it outside your application)


quote:
Originally posted by Baggins
Oh, i belive this is not possible because all variables in JScript are variants and it would not work with the arguments being of different,
That isn't the reason. If it was, then it would also be impossible for Plus! to add this to the scripting engine... The reason is simply because such an instruction is not included nativly (unfortunatly, but understandable).

quote:
Originally posted by Baggins
however, you can get a dynamic wrapper (ActiveX) .dll which takes the variants and passes them onto the requested function in the correct type.

i will update this when i find it

dnwrap.dll + readme.txt
Please, never attach files and other programs like that to posts. Always link to the original download pages for obvious reasons:
- updates
- important info
- untampered with packages
- original code
- etc...

The original Dynawrap.dll... is available from here:
http://cwashington.netreach.net/main/tools/default.asp?topic=a-m