What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Function dll C# in scripts ( Msg+ )

Function dll C# in scripts ( Msg+ )
Author: Message:
melliott
New Member
*


Posts: 1
Joined: Mar 2008
O.P. Function dll C# in scripts ( Msg+ )
Hi,

I have problem. How can I use function dll written in C# to writting scripts ( to Msg+ ) in JS?

Namespace dll:
testdll
Class:
connect
Function:
polacz
03-02-2008 01:40 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Function dll C# in scripts ( Msg+ )
You want to take a look at Interop.Call:

quote:
The Interop::Call function allows scripts to call functions located in external libraries. For example, it can be used to call functions from the Windows API.



code:
[number] Interop.Call(
    [string] DllName,
    [string] FunctionName,
    [var, optional] Param1,
    [var, optional] Param2,
    [var, optional] Param3,
    [var, optional] Param4,
    [var, optional] Param5,
    [var, optional] Param6,
    [var, optional] Param7,
    [var, optional] Param8,
    [var, optional] Param9,
    [var, optional] Param10,
    [var, optional] Param11,
    [var, optional] Param12
);


The return value is whatever the function returns. Example:

code:
    var value = Interop.Call("User32","EnableWindow", hWnd, false);

<Eljay> "Problems encountered: shit blew up" :zippy:
03-02-2008 05:43 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Function dll C# in scripts ( Msg+ )
quote:
Originally posted by SpunkyLoveMuff
You want to take a look at Interop.Call:

no, he doesn't.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
03-02-2008 07:43 PM
Profile PM Web Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Function dll C# in scripts ( Msg+ )
isn't it Interop.Call2 ?

quote:
The Interop::Call2 function allows scripts to call functions located in custom made external libraries and return a string. It acts exactly like Call except that it expects a BSTR as return value.

This post was edited on 03-02-2008 at 10:39 PM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
03-02-2008 10:38 PM
Profile PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Function dll C# in scripts ( Msg+ )
Interop::Call can also call from custom libraries, the only difference is that Interop::Call2 returns a string.

Melliott, you will need to make sure the function you want to call is exported from the dll. Then just put the path of the library, name of the export, and the parameters you want into Interop::Call or Interop::Call2 (depending on if the function returns a string or not).

EDIT: From a quick google search, it looks like you cannot export with C# (I may be wrong, I do not use C#) but you can create a library which can be registered to use with COM.

This post was edited on 03-02-2008 at 10:58 PM by deAd.
03-02-2008 10:48 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Function dll C# in scripts ( Msg+ )
quote:
Originally posted by roflmao456
isn't it Interop.Call2 ?

no, because neither of them work on .NET libraries. besides, call and call2 do the same thing, except call2 is for functions that return a string.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
03-02-2008 10:53 PM
Profile PM Web Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: Function dll C# in scripts ( Msg+ )
C# is dotNet, which means that the executable-format is way different. It doesn't have anything such as exports, so you cannot use any Interop method to call it. DotNet is managed code, so you there's not a chance you can call it just like it would be native, but of course, there are workarounds. They're dirty, bad and they're called COM.
Oh, and they don't work well on Vista. :(
4 8 15 16 23 42
03-02-2008 11:40 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On