Shoutbox

Sorry if this has been asked... - 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)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Sorry if this has been asked... (/showthread.php?tid=51208)

Sorry if this has been asked... by frak on 10-01-2005 at 02:23 AM

But I am trying to find either some kind of advanced howto or some more involved source code that is given away with the API download.

Would anyone here be so kind as to point me in the right direction?


RE: Sorry if this has been asked... by RaceProUK on 10-03-2005 at 01:45 PM

What sort of examples are you looking for?


RE: Sorry if this has been asked... by CookieRevised on 10-03-2005 at 02:27 PM

quote:
Originally posted by frak
But I am trying to find either some kind of advanced howto or some more involved source code that is given away with the API download.

Would anyone here be so kind as to point me in the right direction?
Start by reading the official Help pages. It is clearly stated there:

http://www.msgplus.net/help.php

on the bottom it states:
quote:
Plugin API: get the latest documentation of the Messenger Plus! API and create your own plugin today!

RE: Sorry if this has been asked... by frak on 10-03-2005 at 03:10 PM

I have the API docs, but my question isn't so much about the Messenger API - that I can deal with.

What I want is an example test harness, as I am not sure how to go about debugging my (test) plugin.  The DLL is built, I have moved it, registered it, added the relevant reg key and yet nothing happens.

As it is a DLL I am not sure how I would step through the code to find out what is going wrong, and the last thing I want to have to do is put in a load of MsgBox's to find out where it is failing.


RE: Sorry if this has been asked... by CookieRevised on 10-03-2005 at 09:10 PM

If you follow the guidelines in the API doc exactly, then your DLL should run just fine... The procedures in the examples are very important and must be followed exactly. In other words, first check if your dll is loaded correctly. If that is ok, afterwards you can start checking your routines you perform.

You indeed could add some msgboxes. That's the quickest way to find out where something went wrong.


RE: Sorry if this has been asked... by frak on 10-04-2005 at 02:30 PM

Thanks for your continued help, but I think my problem is not so much with the code I have written, but more the process of getting a VB.NET plugin running.  And I would really love to get at the files the following URL that has been mentioned a few times on the forum, but seems to be broken:

http://www.mscorlib.com/DesktopDefault.aspx?tabid=271

If anyone here has a copy of this that they can mail me, please PM me?


RE: Sorry if this has been asked... by CookieRevised on 10-04-2005 at 06:01 PM

interesting threads to read (I know it takes time to read all of it, but it might help a lot):
http://shoutbox.menthix.net/showthread.php?tid=21003
http://shoutbox.menthix.net/showthread.php?tid=19088
http://shoutbox.menthix.net/showthread.php?tid=25027

something which attracted my attention:

quote:
Originally posted by SilenceTi
it is importent in vb.net and c# that you have to register the dll in your register just like vb plugins, AND you will have to set "Register for COM Interop" to true in the project properties.
dunno if that still applies or not though...

---

about http://www.mscorlib.com/DesktopDefault.aspx?tabid=271:
* WebArchive Jan 09, 2004
* WebArchive Mar 16, 2004
The files themself aren't available anymore though...

---

Nevertheless, did you try to run the example plugin (unmodified) in the MPPlugins documentation from Plus!? As all the info in those given threads (and also on mscorlib.com) is really very old information and things might have changed. The current VB.NET sample plugin in the official documentation should work fine...


RE: RE: Sorry if this has been asked... by KokiriChild on 10-04-2005 at 06:07 PM

quote:
Originally posted by CookieReviseddid you try to run the example plugin (unmodified) in the MPPlugins documentation from Plus!?

It's horrible trying to VB.NET plugins to work, and according to the baord getting that VB.NET Plugin to work is even worse again. Sorry I can't be of more help, but "don't follow the example" is what I'm trying to say.

- KokiriChild
RE: Sorry if this has been asked... by CookieRevised on 10-04-2005 at 06:12 PM

quote:
Originally posted by KokiriChild
It's horrible trying to VB.NET plugins to work, and according to the baord getting that VB.NET Plugin to work is even worse again. Sorry I can't be of more help, but "don't follow the example" is what I'm trying to say.

- KokiriChild
I can't confirm nor deny it, I only know that what has been said in those threads is very old and things have changed since then. So I don't know if all that still applies...
RE: Sorry if this has been asked... by frak on 10-04-2005 at 07:04 PM

CookieRevised:

I have COM interop enabled - all I have done is taken the sample project and cut out the code I didn't want.  I have read through all three of the threads that you kindly gave me links to.  I guess what this is teaching me is to give up on VB.NET - I should have known after all the heartache VB 6 has given me over the years.  Is VB6 going to be an easier bet?  Or should I go for the steep curve and choose c++?

KokiriChild:

Do you know of any plugin authors who have succeeded?


RE: Sorry if this has been asked... by J-Thread on 10-04-2005 at 07:13 PM

Music Logger Plus has been written in C#.NET, except some errors after installing it, it does work, but... As far as I know you can only use 1 C#.NET (and probably VB.NET, those are almost the same) plugin in the same time. When installing the second .NET plugin it doesn't work. So when testing, uncheck all the other plugins in your plugin list to make sure that isn't the problem.

Patchou, I think it is a kind of bug in MsgPlus. For the record, I do use the Interop.MessengerAPI.dll.

When registering it with regasm /codebase "path/to/my/plugin" (and the plugin isn't in the plugins dir) it does work, but as I said only 1 plugin a time.

When it is in the plugins dir it does work the same, but when starting messenger for the first time you get an error, so you have to restart messenger (the error about 2 copies of mscoree.dll loaded ...). That's what also happens with Music Logger Plus!


RE: Sorry if this has been asked... by frak on 10-04-2005 at 07:30 PM

quote:
regasm /codebase

Hmmm, I was just using /s - dont tell me this is what I have been doing wrong...

As for other plugins, I dont have any other plugins installed - heresy, I know, but they dont do what I want them too ;o)
RE: Sorry if this has been asked... by J-Thread on 10-04-2005 at 07:32 PM

That may indeed be the problem. I've tested and regasm /codebase turned out to be the best way. And as I said before, the plugin doesn't need to be in the plugins dir, because with the codebase option the full path to the plugin is registered(Y)


RE: RE: Sorry if this has been asked... by KokiriChild on 10-04-2005 at 07:48 PM

quote:
Originally posted by frak
KokiriChild:

Do you know of any plugin authors who have succeeded?


Uhm, no, sorry, we're all VB6 around here, and my plugin would work if it wasn't for the little DisplayToast() problem [link] 8-)

- KokiriChild
RE: Sorry if this has been asked... by CookieRevised on 10-05-2005 at 04:15 PM

quote:
Originally posted by frak
I guess what this is teaching me is to give up on VB.NET - I should have known after all the heartache VB 6 has given me over the years.  Is VB6 going to be an easier bet?
VB6 is extremely easy for making a plugin...

quote:
Originally posted by frak
Or should I go for the steep curve and choose c++?
It has of course some advantages over VB6, like you don't have to register your plugin anymore...

quote:
Originally posted by KokiriChild
Uhm, no, sorry, we're all VB6 around here
'We' are certainly not all VB6 around here. Many people on this forum program in C++, Delphi, VB, Java, etc... And plugins have been created in C++, VB, VB.NET, C#, Dev-C++, and there are even frameworks for VBScript and JavaScript...

RE: Sorry if this has been asked... by KokiriChild on 10-05-2005 at 06:05 PM

quote:
'We' are certainly not all VB6 around here

Sorry! I meant 'we' as in 'we who live in this house', not 'we who post on this forum', apologise for any confusion there, and I think Patchou would slap my VB6 butt with his C++ Libraries if I meant he was a VB programmer too ;)

- KokiriChild
RE: Sorry if this has been asked... by RaceProUK on 10-06-2005 at 12:59 PM

quote:
Originally posted by J-Thread
As far as I know you can only use 1 C#.NET (and probably VB.NET, those are almost the same) plugin in the same time.
I think I can explain why.
When Plus! loads a .NET plugin, it loads MSCOREE.DLL into the process space. When it tries to load the next .NET plugin, it loads MSCOREE.DLL again. However, there's something in MSCOREE.DLL that prevents two copies being loaded at the same time.

If this is true, it doesn't make sense to me: I thought only one copy of a DLL was loaded into the process space anyway, no matter how many (explicit/implicit) calls to LoadLibrary() there are.
RE: Sorry if this has been asked... by J-Thread on 10-06-2005 at 04:17 PM

Yes I thougt of that too...

I did send Patchou an email about it yesterday, so we'll wait for his answer... I hope he can improve plus, or tell us what the right way is to install .NET plugins. We'll see(Y)


RE: Sorry if this has been asked... by frak on 10-07-2005 at 04:45 PM

Unfortunately despite my best efforts I am unable to get any kind of code working using VB.NET - even using the /codebase option (are those warnings normal?)

Thanks for your help anyway guys - I think I may try C++ as I have slightly masochistic tendencies ;o)


Well, having done exactly what I said I wouldn't, I have stuck with trying to nail down what is going wrong with my VB.NET plugin, please consider the following Initialise function

code:
    Public Function Initialize(ByVal nVersion As Integer, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
        MsgBox(sAppName + "::Initialise called!", MsgBoxStyle.OKOnly, "DEBUG")
        MyPlugin.oMessenger = oMessenger
        MsgBox(sAppName + "::Initialise - Got Messenger ref", MsgBoxStyle.OKOnly, "DEBUG")
        Initialize = True
    End Function


There are other things, such as dimming vars and some set-up that I have removed for simplicity, and testing.  Now, when I start Messenger I get the first MsgBox, but not the second.  I have declared my oMessenger as follows:
code:
    Public Shared WithEvents oMessenger As MessengerAPI.Messenger


Although the sample has this as MessengerClass, I changed this because of the code I found in this thread but neither have made any difference - if I try to get a reference to the running Messenger instance, then my function doesn't get past this point.

Any ideas?
RE: Sorry if this has been asked... by J-Thread on 10-07-2005 at 06:34 PM

When you want to use the messengerapi there are some things to do.

-First, add Interop.MessengerAPI as a reference to your project.
-Build your project
-Copy your dll to a dir where you gonna install it
-Copy the Interop.MessengerAPI.dll (which will be in your build dir) to the SAME map as your plugin
-Register your plugin using the codebase option
-Add your plugin name to the msg plus registry key

The reason you only see the first msgbox is, as soon as you try to use the messenger api an error appears and your plugin is closed. When you try it as i destribed above it should work.


RE: Sorry if this has been asked... by frak on 10-07-2005 at 07:05 PM

Sorry, but I have been doing what you have described above (minus the codebase option until I found out about it) from the very beginning...

Anyway, it turns out I had a problem with some logic just after the reference assignment, although I am not sure why that should affect the display of my msgbox just after the reference assigment.

I shall now take my Homer of the Week award bow!


RE: Sorry if this has been asked... by J-Thread on 10-08-2005 at 07:15 AM

code:
Public Shared WithEvents oMessenger As MessengerAPI.MessengerClass

    Public Function Initialize(ByVal nVersion As Integer, ByVal sUserEmail As String, ByVal oMessenger As MessengerAPI.MessengerClass) As Boolean
        MsgBox(sAppName + "::Initialise called!", MsgBoxStyle.OKOnly, "DEBUG")
        MyPlugin.oMessenger = oMessenger
        MsgBox(sAppName + "::Initialise - Got Messenger ref", MsgBoxStyle.OKOnly, "DEBUG")
        Initialize = True
    End Function


Sorry I didn't notice that before!