Shoutbox

can't call my dll's function - 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: can't call my dll's function (/showthread.php?tid=65791)

can't call my dll's function by graphicsxp on 09-03-2006 at 09:51 PM

Hi,
I'm using the script editor in Messenger Plus to load a dll I created using
Visual Studio (class library project in vb.net).

The code of the dll looks like this:

code:
Public Class Msg
    Public Sub New()

    End Sub

    Public Function Display() As Boolean
        MsgBox("hello world")
        Return True
    End Function
End Class

and here is the call from the script:
code:
function OnEvent_ChatWndCreated(ChatWnd)
{
var externLib = MsgPlus.ScriptFilesPath + "\\msn.dll";
MsgPlus.DisplayToast("", externLib);
Interop.Call(externLib, "Display");

}

the error returned is :
Interop.Call could not locate the function "Display"


So I assume the dll was found but not the function withing the dll
Does anyone knows what could be wrong there ?
thanks
RE: can't call my dll's function by Mnjul on 09-07-2006 at 12:21 PM

Since you're using VB.net, you'll need to use regasm to register your DLL and use the following code to call your Display function:

var vbDotNetObject=new ActiveXObject("Namespace.Msg");
vbDotNetObject.Display();

where Namespace is the name of the namespace which your Msg class is in.


RE: can't call my dll's function by graphicsxp on 09-08-2006 at 10:04 PM

Hi,
Thanks for helping!

I've registered the dll using regasm. Now my code looks like this:

code:
Namespace myMSN
    Public Class Msg
        Public Sub New()

        End Sub

        Public Function Display() As Boolean
            MsgBox("hello world")
            Return True
        End Function
    End Class
End Namespace

my jscript is :

code:
function OnEvent_ChatWndCreated(ChatWnd)
{
var vbDotNetObject = new ActiveXObject("myMSN.Msg");
vbDotNetObject.Display();
MsgPlus.DisplayToast("", vbDotNetObject.Display());
}
and yet it doesn't do anything :(

Do you have an idea why ?

I can't even see the debug window, it's gone for some reason and I can't reactivate it even if I tick the checkbox in the options...



RE: can't call my dll's function by ShawnZ on 09-08-2006 at 10:06 PM

quote:
Originally posted by graphicsxp
I can't reactivate it even if I tick the checkbox in the options...

there's no checkbox to open the debug window, there's a menu item under Plus!. the checkbox just enables that menu item :p
RE: can't call my dll's function by graphicsxp on 09-08-2006 at 10:09 PM

arf... you are right, I got it now.../ thanks

What about my dll issue, can someone help ?

The error I get is:
An ActiveX component cannot create an object