What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Using C# DLL

Using C# DLL
Author: Message:
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: RE: RE: Using C# DLL
quote:
Originally posted by CookieRevised
quote:
Originally posted by felipEx
quote:
COM classes must have a parameterless Public Sub New() constructor, or the class will not register correctly
Walkthrough: Creating COM Objects with Visual Basic .NET
That only applies for VB.NET (right?).

He is using C#...
It doesn't matter at all if it's C#/VB.NET, COM classes must have a parameterless constructor in order to register correctly. Sorry if I wasn't clear in the first place ;-)

Just made a quick test and it's working:
Spoiler:

C# code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
 
namespace MyDLL
{
    [ComVisible(true)]
    public class Operations
    {
        /// <summary>
        /// Parameterless constructor required in order to register correctly
        /// </summary>
        public Operations()
        {
        }
 
        public string getValue1(string sParameter)
        {
            switch (sParameter)
            {
                case "a":
                    return "A was chosen";
 
                case "b":
                    return "B was chosen";
 
                case "c":
                    return "C was chosen";
 
                default:
                    return "Other";
            }
        }
        public string getValue2()
        {
            return "From VBS String Function";
        }
    }
}

JScript code:
var x = new ActiveXObject("MyDLL.Operations");
Debug.Trace(x.getValue2());
x = null;

quote:
Originally posted by output
Script is starting
Script is now loaded and ready
Function called: OnEvent_Initialize
From VBS String Function
10-23-2010 05:15 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Using C# DLL - by barby850717@gmail. on 10-20-2010 at 08:48 PM
RE: Using C# DLL - by Matti on 10-20-2010 at 09:15 PM
RE: Using C# DLL - by barby850717@gmail. on 10-20-2010 at 09:26 PM
RE: Using C# DLL - by CookieRevised on 10-21-2010 at 08:21 AM
RE: Using C# DLL - by barby850717@gmail. on 10-21-2010 at 01:32 PM
RE: Using C# DLL - by matty on 10-21-2010 at 10:27 PM
RE: Using C# DLL - by felipEx on 10-22-2010 at 02:33 AM
RE: RE: Using C# DLL - by CookieRevised on 10-22-2010 at 07:12 AM
RE: RE: RE: Using C# DLL - by felipEx on 10-23-2010 at 05:15 AM
RE: Using C# DLL - by CookieRevised on 10-23-2010 at 08:27 AM
RE: Using C# DLL - by SmokingCookie on 10-28-2010 at 06:02 PM


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