What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » trying to create a c# COM server

Pages: (2): « First [ 1 ] 2 » Last »
trying to create a c# COM server
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
O.P. trying to create a c# COM server
Hello D:

Im trying to create a COM server and let it call events (which the jscript binds to) but the events aren't getting set right (though it works in wscript) :( it just errors


Heres working code in jscript using wscript
Javascript code:
o = WScript.CreateObject("comtest.sniffer");
WScript.ConnectObject(o, "o_")
 
function o_onPacket(){
    Wscript.Echo("Event Called!");
}
 
o.run();


then using plus, I have to use an alternate way to hook up events and then it just fails with

quote:
Error: Object reference not set to an instance of an object. (code: -2147467261)


which means that the event isn't being set....

Javascript code:
o = WScript.CreateObject("comtest.sniffer");
 
function x(){
    function o::onPacket(){
        Debug.Trace("Event called!");
    }
    o.run();
}
x();
 




Here the code for the COM server

C# code:
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
 
namespace comtest {
 
    [ComVisible(false)]
    public delegate void onPacketAr();
 
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    [ComVisible(true)]
    public interface CallbackEventInterface {
        [DispId(1)]
        void onPacket();
    }
 
    [ComVisible(true)]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface IDotNetEventSender {
        void run();
    }
 
    [ComSourceInterfaces(typeof(CallbackEventInterface))]
    [ClassInterface(ClassInterfaceType.None)]
    [ComVisible(true)]
    public class sniffer : IDotNetEventSender {
        public sniffer() { }
        public event onPacketAr onPacket;
       
        public void run() {
            onPacket() ;
        }
    }
}



help? :P


(attached the project file)

.zip File Attachment: comtest.zip (3.28 KB)
This file has been downloaded 236 time(s).

This post was edited on 02-16-2009 at 06:50 AM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
02-16-2009 06:24 AM
Profile PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
O.P. RE: trying to create a c# COM server
anyone? :(
[Image: dt2.0v2.png]      Happy Birthday, WDZ
02-19-2009 04:57 AM
Profile PM Web Find Quote Report
Dr Nick
Junior Member
**

Avatar
Firefox > IE

Posts: 59
Reputation: 1
31 / Male / Flag
Joined: Dec 2008
RE: trying to create a c# COM server
So, its absolutely essential that c# is used for this script?

Trying to help as much as I can here ;)
<?
while(!success) { $try++; }
?>
-----------------
Windows 7 Ultimate (6.1.7000)
Windows Live Messenger 14.0.0206
Messenger Plus! Live 4.81.0.358
02-19-2009 09:39 AM
Profile PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: trying to create a c# COM server
Umm why are you using CreateObject?

JScript code:
var o = new ActiveXObject("comtest.sniffer");


and everything else works fine :P

ok scrap that, it decided it didn't want to work all of a sudden.

JScript code:
var o = new ActiveXObject("comtest.sniffer");
 
function OnEvent_Initialize(){
    function o::onPacket(){
        Debug.Trace("Event called!");
    }
    o.run();
}


That should work, Plus! seems to be fussy about initialisation stuff *shrugs*

* Eljay is intrigued by the class name though :P

This post was edited on 02-19-2009 at 09:22 PM by Eljay.
02-19-2009 09:17 PM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
O.P. RE: trying to create a c# COM server
quote:
Originally posted by Eljay
Umm why are you using CreateObject?

JScript code:
var o = new ActiveXObject("comtest.sniffer");


and everything else works fine :P

ok scrap that, it decided it didn't want to work all of a sudden.

JScript code:
var o = new ActiveXObject("comtest.sniffer");
 
function OnEvent_Initialize(){
    function o::onPacket(){
        Debug.Trace("Event called!");
    }
    o.run();
}


That should work, Plus! seems to be fussy about initialisation stuff *shrugs*

* Eljay is intrigued by the class name though :P

\o/ it works...
[Image: dt2.0v2.png]      Happy Birthday, WDZ
02-20-2009 12:16 AM
Profile PM Web Find Quote Report
Dr Nick
Junior Member
**

Avatar
Firefox > IE

Posts: 59
Reputation: 1
31 / Male / Flag
Joined: Dec 2008
RE: trying to create a c# COM server
ooo Yay, so as for the User is typing notification (and whatever else this can do) when will it be released?

I for one am very eager to use it ;)

Thanks soo much
Nick
<?
while(!success) { $try++; }
?>
-----------------
Windows 7 Ultimate (6.1.7000)
Windows Live Messenger 14.0.0206
Messenger Plus! Live 4.81.0.358
02-20-2009 06:08 AM
Profile PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
O.P. RE: trying to create a c# COM server
quote:
Originally posted by Dr Nick
ooo Yay, so as for the User is typing notification (and whatever else this can do) when will it be released?

I for one am very eager to use it ;)

Thanks soo much
Nick
just got very busy, next week sometime
[Image: dt2.0v2.png]      Happy Birthday, WDZ
02-20-2009 01:03 PM
Profile PM Web Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: trying to create a c# COM server
what about 64-bit support in now playing
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.
02-20-2009 01:37 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: trying to create a c# COM server
quote:
Originally posted by -dt-
quote:
Originally posted by Dr Nick
ooo Yay, so as for the User is typing notification (and whatever else this can do) when will it be released?

I for one am very eager to use it ;)

Thanks soo much
Nick
just got very busy, next week sometime


I'll gladly test it. I'm always looking for more fun things to do with sniffing :p
<Eljay> "Problems encountered: shit blew up" :zippy:
02-20-2009 01:47 PM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
O.P. RE: trying to create a c# COM server
quote:
Originally posted by ShawnZ
what about 64-bit support in now playing
ready to make a new wmp support dll?
[Image: dt2.0v2.png]      Happy Birthday, WDZ
02-20-2009 02:19 PM
Profile PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« 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