What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Stop the X button from closing a PlusWnd

[?] Stop the X button from closing a PlusWnd
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
O.P. [?] Stop the X button from closing a PlusWnd
Hello again! :P

Countdown Live is almost ready to rock! Now I need some help again...
As you know, a PlusWnd has a close button in the top right corner. When you click it, it'll close the window. I now want to stop it closing the window and display a confirmation box if the user really wants to close the window without saving the changes first. When the user chooses Yes, it'll close the window. When the user chooses No, the window has to stay open.
Now, how the hell should I do that?! :S

code:
Code for the box
//PlusWnd is the options window. (duh)
//"Language.WndOptions['CloseConfirm']" is a string containing the question.
var result = Interop.Call('User32', 'MessageBoxW', PlusWnd.Handle, Language.WndOptions['CloseConfirm'], 'Countdown Live', 0x42124);
if(result == 6) { //Yes
    //Close window
} else { //No
    //Don't close!!!
}

Thanks in advance! ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-11-2006 09:03 AM
Profile E-Mail PM Web Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
Status: Online
RE: [?] Stop the X button from closing a PlusWnd
If I remember correctly, there is a "Cancel" parameter that tells if the window should close or not.
I'm looking into it...
YouTube closed-captions ripper (also allows you to download videos!)
08-11-2006 09:07 AM
Profile E-Mail PM Web Find Quote Report
Ash_
Senior Member
****

Avatar

Posts: 638
Reputation: 31
35 / Male / –
Joined: Aug 2004
RE: [?] Stop the X button from closing a PlusWnd
code:
function OnSong2AvatarEvent_CtrlClicked(PlusWnd, ControlId){
if(ControlId == 'BaseBtnCancel') {
MsgPlus.CancelTimer("CheckSong");
}
}


is what i use to check if they click the x button, then if they do it cancels my timer, simply change my cancel timer call to wahtever you need (I'd do it myself but i can't be bothered :P)
[Image: jeansiger5.jpg]
08-11-2006 09:18 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
O.P. RE: [?] Stop the X button from closing a PlusWnd
That did the trick! :D Never knew there was such special control id available! :)

Thanks all! ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-11-2006 01:47 PM
Profile E-Mail PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: [?] Stop the X button from closing a PlusWnd
Or, in the OnWndDestroyed thingy or whatever, just return true to cancel the event :) much easier

EDIT: There's also an XML attribute that lets you remove the box also.

This post was edited on 08-11-2006 at 02:42 PM by deAd.
08-11-2006 02:42 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [?] Stop the X button from closing a PlusWnd
code:
function OnWndCountDownDisplayEvent_Destroyed(Wnd, nExitCode){
    if (TimerLength > 1){
        OnWndCountDownDisplayEvent_Cancel = true;
    }
}
   
function OnWndCountDownDisplayEvent_Cancel(Wnd){
    if (TimerLength > 1){
        return true;
    }
}


That is how I do it on Screenshot Sender 4. Remember that TimerLength is the TimerCountdown included in the program. This will also prevent the user from pressing the Esc key on the keyboard to close the window.

This post was edited on 08-12-2006 at 12:58 AM by matty.
08-11-2006 02:48 PM
Profile E-Mail PM 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