Thread or Window - 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: Thread or Window (/showthread.php?tid=28419) Thread or Window by CMI on 07-09-2004 at 11:05 PM Is there any way to get a seperate thread or window running from inside a plug in? I'm getting nothing but crashes and errors. It seems the only way to get plug-in to execute code is when MP! calls events. I'd like to get around that. RE: Thread or Window by Mnjul on 07-10-2004 at 03:03 AM There could be security issues; and Plus! doesn't accept many functino calls whose caller isn't in the same thread as plugin's initialize function. Well, sort of, it may be the plugin developer who should solve this problem RE: RE: Thread or Window by CMI on 07-10-2004 at 03:40 AM
quote: So that's a "no"? I don't really see how creating a thread is a security issue... I wouldn't be talking to Plus! anyway. I'd be perfectly happy using the IMessenger interface. This seems to be my only option because I certianly didn't see a timer function for plug-ins in Plus!, which would be nice. RE: Thread or Window by Mnjul on 07-10-2004 at 03:43 AM What kind of timer function do you need? RE: RE: Thread or Window by CMI on 07-10-2004 at 04:15 AM
quote: I just need a function inside a plug-in that can either use IMessenger or talk to Plus! and will be triggered predictably at least every couple of seconds. RE: Thread or Window by Mnjul on 07-10-2004 at 04:59 AM You can set IMessenger as a global variable and use SetTimer in Initialize, and set up a TimerProc call back function, I think... RE: RE: Thread or Window by CMI on 07-10-2004 at 05:51 AM
quote: I thought about that but for some reason I didn't think it would work. I guess I'll give it a shot, since I can't think of a good reason it wouldn't work. RE: Thread or Window by Mnjul on 07-10-2004 at 07:12 AM Well, perhaps you may give it a try and if it doesn't really work, we can have further discussion RE: Thread or Window by Mike on 07-10-2004 at 07:18 AM
Also in what programing language are you gonna do it? RE: Thread or Window by Millenium_edition on 07-10-2004 at 08:35 AM
what you can do is reference the MessengerAPI code:Then in the initialize function code:Replace <insert object name here> with the Messenger object Initialize provides. Also, you can use Class_Initialize and Class_Terminate to show/hide your forms (in vb) and there you can do what you want RE: Thread or Window by CMI on 07-10-2004 at 04:04 PM Well, SetTimer mostly works. If I'm not really careful it brings down Messenger Plus and concequently MSN Messenger. Of course, now I can't get actions to properly fire using the IMessenger interface. Man I hate Visual Basic. RE: Thread or Window by Mnjul on 07-10-2004 at 04:10 PM
You hate VB? Well, great, I code in C++ RE: Thread or Window by CMI on 07-10-2004 at 04:15 PM Well, this plug-in is to support a fairly large behind schedule VC++ app. I'm using VB to get things done faster. Of course, I'm still having the problem where a video invite won't fire If anyone is curious, http://www.msnfanatic.com/forums/index.php?showtopic=9888&st=0& RE: Thread or Window by RaceProUK on 07-11-2004 at 02:54 PM
Mnjul, you don't have to QueryInterface, a mere typecast to IMessenger3* will do the trick (not pretty though I admit). code:I've only used it with a function that takes a single argument, so I'm not sure how it would handle multiple arguments, but a quick search on MSDN should help. My guess is that you'd have to do a little bit of processing yourself: others on the forums may be able to help you more. Also, remember to #include <process.h>, or it won't compile. Don't worry about ending the thread: once the function returns, the thread is terminated by Windows. RE: Thread or Window by RaceProUK on 07-11-2004 at 05:04 PM Just because its Win32, doesn't mean you have to use its API. I prefer writing non-platform specific code if I can. RE: RE: Thread or Window by CMI on 07-11-2004 at 07:07 PM
quote: I wrote the plug-in in VB, so there is no point trying to use platform independant APIs The SetTimer call is working just fine, but I'm still having that StartVideo problem no one seems to know anything about. RE: Thread or Window by RaceProUK on 07-11-2004 at 08:05 PM
CMI: RE: Thread or Window by CMI on 07-11-2004 at 08:06 PM How about we forget about all this and head over to me StartVideo thread RE: Thread or Window by RaceProUK on 07-11-2004 at 08:11 PM
Good idea. RE: Thread or Window by RaceProUK on 07-11-2004 at 08:26 PM Do you know for certain though? I know I don't. Why not run a little test, say create 1000 threads using each method and measuring the resource usage some way. RE: Thread or Window by RaceProUK on 07-11-2004 at 08:45 PM Intriguing... |