What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Detecting when a Plus! Window is closed

[?] Detecting when a Plus! Window is closed
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: [?] Detecting when a Plus! Window is closed
quote:
Originally posted by Matti

...or do you only want to call the OnWindowIdEvent_Destroyed function without actually destroying the window?

...I'd suggest you to move the contents of the event function to some other place. Calling a function in the global scope by its function name in JScript can only be done using eval() and as you know, eval is evil and should be avoided as much as possible. Here's a possible solution:

[CODE SNIPPED]
In this situation, what is the benefit of your code opposed to a simple:
jscript code:
function OnWndMainEvent_Destroyed(PlusWnd, ExitCode) {
    // some code
}

function RandomFunction() {
    // some code
    // Call the OnWndMainEvent_Destroyed() event in code.
    OnWndMainEvent_Destroyed(pPlusWnd, 0)
    // some code
}
???

According to your explaination you can't do the above. But I don't see why you can't, it works perfectly and is done all the time in many scripts (and doesn't use eval() at all).

-----------------------------------------------------------------------------------------------


quote:
Originally posted by Matti
Well, the easiest thing would be to create all possible Destroyed events and those can then check whether they have been created by that main window and then do something.
I think his point is that he does not know the Window IDs at all at the time of writing the code. Aka: the Window IDs can be anything at any point. He only knows the Windows IDs when the combobox is created and populated. So he obvisouly can not hard code a gazzilion Destroyed() events.

What would solve everything is a OnWnd_Destroyed(PlusWnd, ExitCode) which will trigger when _any_ plus window is destroyed.

Otherwise I'm afraid you need to look into subclassing in one way or the other.

On the other hand, if you only want to check if the windows still exist in a certain known event (like on the press of a button), you could simply also store the Window Handles of those windows (thus together with the Plus! Window IDs to show to the user) and use a Windows API to check if those windows still exist by passing the window handle. So the question also becomes: When do you want to check if those windows are still there? What's the purpose of checking if they still exist?

This post was edited on 10-16-2009 at 06:11 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-16-2009 05:47 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[?] Detecting when a Plus! Window is closed - by ryxdp on 10-13-2009 at 08:36 AM
RE: [?] Detecting when a Plus! Window is closed - by matty on 10-13-2009 at 01:17 PM
RE: [?] Detecting when a Plus! Window is closed - by ryxdp on 10-14-2009 at 03:10 AM
RE: [?] Detecting when a Plus! Window is closed - by Matti on 10-14-2009 at 12:08 PM
RE: RE: [?] Detecting when a Plus! Window is closed - by ryxdp on 10-14-2009 at 10:46 PM
RE: RE: [?] Detecting when a Plus! Window is closed - by CookieRevised on 10-16-2009 at 05:47 PM
RE: RE: RE: [?] Detecting when a Plus! Window is closed - by ryxdp on 10-16-2009 at 11:13 PM
RE: [?] Detecting when a Plus! Window is closed - by Matti on 10-16-2009 at 03:33 PM
RE: [?] Detecting when a Plus! Window is closed - by CookieRevised on 10-16-2009 at 11:50 PM
RE: RE: [?] Detecting when a Plus! Window is closed - by ryxdp on 10-17-2009 at 12:06 AM
RE: [?] Detecting when a Plus! Window is closed - by Matti on 10-17-2009 at 08:55 AM


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