Shoutbox

Using DisplayToast in thread - 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: Using DisplayToast in thread (/showthread.php?tid=33799)

Using DisplayToast in thread by KooKiz on 10-29-2004 at 01:06 PM

Hi, i'm coding an rss reader plugin but i've got a little problem.
My plugin's Initialize function launch a new thread that check periodically an url to see if the rss stream had changed. In that case i'd like to display a popup notification. So I wrote in my thread code :

If (form.rss_read() = 1) Then
     MsgBox("test")
     DisplayToast("news : " + lastrss, "Rss Feeder", urlrss, True)
End If


The message box is shown, but I don't see the popup :(
And if I try to show a popup in ParseCommand, that works well. Do you know where is the problem ? Is there a way to call this function from a thread ?

edit : I'm creating it in VB.Net, if you didn't recognize :)


RE: Using DisplayToast in thread by Mnjul on 10-29-2004 at 01:30 PM

As Patchou said in the documentation (MPPluginConst.vb),

quote:
DisplayToast
    '//   Technical Note: the message must be sent from the same thread  //
    '//   Initialize() was called, else, Messenger Plus! will reject the //
    '//   call for security reasons.                                     //

So you can't call the function in thread other than Initialize(), for security reasons :)

RE: Using DisplayToast in thread by Concord Dawn on 10-29-2004 at 01:48 PM

Once again we see evidence of Patchou's uber programming. Is it like that so that dodgy programs can't be bundled in with plugins easily?


RE: Using DisplayToast in thread by KooKiz on 10-29-2004 at 01:52 PM

I'll search an other way to make it then :/
Do you now a simple way for my thread to make the main thread call DisplayToast ? I discovered MsgPlus yesterday so i'm not familiar with this api yet...


RE: Using DisplayToast in thread by KooKiz on 11-01-2004 at 07:07 PM

DisplayToast
SetNewName
SendMessage
Initialize
Uninitialize
Configure
PublishInfo
ParseCommand
ParseTag
ReceiveNotify

Are they the only function to interact with messenger plus or are there some more ?


TheBlasphemer > If I create a window in Initialize, isn't it a new thread ?


RE: Using DisplayToast in thread by Patchou on 11-01-2004 at 07:46 PM

TB gave the best answer possible, that's how Messenger Plus! do it itself when it calls some stuff from Messenger. Create the window in yourmain thread. From your worker thread, send a message to this window and make the window call DisplayToast, Windows will do the rest for you :)


RE: Using DisplayToast in thread by KooKiz on 11-04-2004 at 12:43 PM

Thanks.
My plugin is nearly done, but I need a last bit of help.
I'd like to change user's own phone number to use messenger API function oMessenger_OnMyPhoneChange. To do that, I found the function oMessenger.Phone(vContact as object, ePhoneNumber as MessengerAPI.MPHONE_TYPE, bstrNumber As String)

I don't have any problem for ePhoneNumber and bstrNumber, but I don't know what I should put in vContact to change user's phone number.

Someone do ? :)