What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Invoking main thread in plugin to call DisplayToast

Invoking main thread in plugin to call DisplayToast
Author: Message:
ketchup_blade
New Member
*


Posts: 8
Joined: Jul 2005
O.P. Invoking main thread in plugin to call DisplayToast
I'm a C# programmer, not really a VB.net programmer, and I am unable yet to get back to the main thread of my plugin (that I'm coding in VB.net).

Desc: I have my plugin thread in VB.net that is calling some library I wrote in C# which generate an event that my plugin receives on callback.  However, since the event is not generated on the main thread, when I call DisplayToast, nothing shows up (which is normal as stated by this line in the function definition of DisplayToast by Patchou) : "Technical Note: the message must be sent from the same thread Initialize() was called, else, Messenger Plus! will reject the call for security reasons."

Question: how can I use delegates in VB.net to get back to my main thread? Normally using C#, I would do something like this to get to my main thread:

public delegate void CompletedMyFunctionDelegate( bool callSuccess );
private void CompletedMyFunction(bool callSuccess)
{
  if( this.InvokeRequired )
  {
    this.Invoke(new CompletedMyFunctionDelegate(CompletedMyFunction), new object[] { callSuccess });
       return;
  }

  // other code here running on main thread
}

any help from VB.net programmers would be appreciated.

thanks.
07-07-2005 01:26 PM
Profile E-Mail PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Invoking main thread in plugin to call DisplayToast
Does VB.NET not have this 'delegates' feature? Given the .NET runtime and the Common Language schnazz, it should be possible to mix-and-match VB.NET and C# - it's just a case of getting the right keywords.
[Image: spartaafk.png]
07-07-2005 08:29 PM
Profile PM Web Find Quote Report
« 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