Shoutbox

Custom Sounds Plugin - HELP [now it is getting really weird...] - 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: Custom Sounds Plugin - HELP [now it is getting really weird...] (/showthread.php?tid=12969)

Custom Sounds Plugin - HELP [now it is getting really weird...] by rh on 07-14-2003 at 10:16 AM

hi!

i have created a custom sounds plugin... very quick'n'dirty but who cares :D

it plays any sound that is located on some server through an embedded Windows Media Component. so before usin a custom sound, you will have to upload the file to a server, but it think this should be acceptable, because it makes possible streamed playback (without transfering the whole file first) and also gives a certain flooding-protection (because windows media only plays one file at a time).

the plugin is nearly done, just transfering the command to play the sound to the other person does not work. i used the ping-pong-example by patchou and changed just very few things still it simply does not work; the ReceiveNotify-function is not called at all!

would be nice if you could help me! thanks a lot!

rupert

p.s.: here's my code:

code:
'//////////////////////////////////////////////////////////////////////
'//                                                                  //
'// Project: Messenger Plus! simple plugin in Visual Basic           //
'// Author: Patchou                                                  //
'// Last Update: 2003/07/06                                          //
'//                                                                  //
'// For more help, please read the documentation in MPPluginDef.cls  //
'// and in MPPluginConst.bas                                         //
'//                                                                  //
'//////////////////////////////////////////////////////////////////////
Option Explicit


'//////////////////////////////////////////////////////////////////////
'//                                                                  //
'// Purpose: Initialization function                                 //
'//                                                                  //
'//////////////////////////////////////////////////////////////////////
Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
    Initialize = True
End Function


'//////////////////////////////////////////////////////////////////////
'//                                                                  //
'// Purpose: Uninitialization function                               //
'//                                                                  //
'//////////////////////////////////////////////////////////////////////
Public Function Uninitialize()
End Function


'//////////////////////////////////////////////////////////////////////
'//                                                                  //
'// Purpose: Provide new commands in Messenger Plus!                 //
'//                                                                  //
'//////////////////////////////////////////////////////////////////////
Public Function ParseCommand(ByVal sCommand As String, ByVal sCommandArg As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
           
    'The second sample command simulates a !ping request. See
    'ReceiveNotify() for more information. You could improve it by ignoring
    'the next ReceiveNotify() call to avoid a local answer (obviously, you
    'can ping yourself).
    If (StrComp(LCase(sCommand), "/xcustomsound", vbTextCompare) = 0) Then
        sResult = Chr(nCCNotify) + "xcsnd" 'The notify code must be 5 characters long
        sResult = sResult + sCommandArg
        Load Form1
        Form1.MediaPlayer1.FileName = sCommandArg
        Form1.MediaPlayer1.Play
       
       
        ParseCommand = True
        Exit Function
    End If
   
    'Give other plugins a chance to parse this command
    ParseCommand = False
End Function


'//////////////////////////////////////////////////////////////////////
'//                                                                  //
'// Purpose: Provide new tags in Messenger Plus!                     //
'//                                                                  //
'//////////////////////////////////////////////////////////////////////
Public Function ParseTag(ByVal sTag As String, ByVal oConversationWnd As Object, ByRef sResult As String) As Boolean
 
    'Give other plugins a chance to parse this tag
    ParseTag = False
End Function


'//////////////////////////////////////////////////////////////////////
'//                                                                  //
'// Purpose: Allow special actions when a plugin text is received    //
'//                                                                  //
'//////////////////////////////////////////////////////////////////////
Public Function ReceiveNotify(ByVal sNotifyCode As String, ByVal sText As String, ByVal oConversationWnd As Object, ByRef sTextToSend As String) As Boolean
  MsgBox ("Debug: -" & sText & "-")
    'This sample responds to a !ping request sent by /xpingvb
    If (StrComp(sNotifyCode, "xcsnd", vbTextCompare) = 0) Then
       
        Load Form1
        Form1.MediaPlayer1.FileName = sText
        Form1.MediaPlayer1.Play
        sTextToSend = "[Succesfully played.]"
       
        ReceiveNotify = True
        Exit Function
    End If
   
    'Give other plugins a chance to receive this notification
    ReceiveNotify = False
End Function


RE: Custom Sounds Plugin - HELP by Xerxis on 07-14-2003 at 10:51 AM

load form1 interupts the thread
you have to use

form1.show vbmodal,screen.activeform


RE: Custom Sounds Plugin - HELP by rh on 07-14-2003 at 12:42 PM

hi!

thanks for your idea, but it did not help.

as you can see i don't want to to DISPLAY the form, i just need it to be loaded, so that the windowsmedia-control gets initialized. and it works so far, because on the local pc you CAN hear the sound.

it's just that on the remote PC the ReceiveNotify-function is not being called... not even the debug-msgbox at the beginning is being displayed... but the message IS being transfered to the remote pc, because you can see the "sText" in the chat window there.

still, i have tried your idea and out-commented the "load form1" (it is not required as i realized), but the problem persists...

anyone another idea? thanks a lot!

regards,

rh


RE: Custom Sounds Plugin - HELP by Whacko on 07-14-2003 at 01:03 PM

ok, cant find the problem :(

but i did find something else... in the ParseCommand Function you play the custom sound... and in ReceiveNotify too.

the local pc ALSO receives the receiveNotify() you send... so playing the sound in ParsCommand, isnt really necessary :)
so if you do both... you should hear the sound twice :P so that maybe a way to debug your code.

i will try to find your problem still. but i thought this bit would help you in any case :)


RE: Custom Sounds Plugin - HELP by rh on 07-14-2003 at 01:55 PM

jup this is definitly useful :D
but this shows me that there is something REALLY wrong.

because when the local pc is meant to receive the receiveNotify as well, then i should be able to see the debug-msgbox everytime i use the command - but i don't. so it seems that the whole launching of the ReceiveNotify is wrong... could it be that there is something wrong with the "nCCNotify"?


RE: Custom Sounds Plugin - HELP by rh on 07-14-2003 at 01:56 PM

BTW i use VB6 for compiling, that should be okay, shouldn't it?


RE: Custom Sounds Plugin - HELP by Whacko on 07-14-2003 at 02:28 PM

you could try entering the notifycode by yourself and see what happens:

<CTRL>+<TAB>+xcsnd+ Http://your file.sound


RE: Custom Sounds Plugin - HELP by rh on 07-14-2003 at 02:34 PM

hi!

good idea! i did that and the result was the following:

quote:
And if there's one thing that I learned when I was still a child... sagt:
http://www.hwnd.de/persdata_rupert/custsnd.mp3


so this is as intended - the code is recognized as a code and is hidden. but: the ReceiveNotify is not being executed... a bug in plus! ????
RE: Custom Sounds Plugin - HELP by rh on 07-15-2003 at 10:09 AM

HELP! :)


RE: Custom Sounds Plugin - HELP by Xerxis on 07-15-2003 at 10:36 AM

leave the load form out of it
and try again


RE: Custom Sounds Plugin - HELP by rh on 07-15-2003 at 11:10 AM

as mentioned above, i already tried this without success... :(


RE: Custom Sounds Plugin - HELP by rh on 07-15-2003 at 11:24 AM

ok now it's getting really weird. i compiled the ping-pong-sample from patchou without any changes, and it is showing exactly the same behavior as my own DLL: receiveNotify is not being called.

i used Visual Basic 6.0 Enterprise German for compiling...

any ideas? thanks!


RE: Custom Sounds Plugin - HELP [now it is getting really weird...] by rh on 07-15-2003 at 01:50 PM

it really seems to be a bug in plus!, even the precompiled mppluginvb.dll does not work