What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Disable access to parent chat window when child xml window open

Pages: (2): « First [ 1 ] 2 » Last »
Disable access to parent chat window when child xml window open
Author: Message:
the andyman
Junior Member
**

Avatar
Windows Live Fanatic

Posts: 92
Reputation: 4
– / Male / Flag
Joined: Apr 2005
O.P. Disable access to parent chat window when child xml window open
Is it possible to make it so that a window that is brought up by a script has to be on top of the conversation window that it was brought up by. I.e. the script/new xml window has to closed or another action taken in it which closes it before anything can be done or clicked in the parent (conversation) window.

I have tried looking for info in the script docs for this with no luck. I presume it will probably be some tag or property I need to add to the xml of the new window.

I hope someone understands what I mean and can help. Thanks.


EDIT: I am also having trouble closing the new xml window when one of the buttons is pressed, in the js I'm telling it to Wnd.Close(1); when either is pressed, is this right?

This post was edited on 12-05-2006 at 10:29 PM by the andyman.
12-05-2006 10:27 PM
Profile E-Mail PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Disable access to parent chat window when child xml window open
quote:
Originally posted by MSDN
The EnableWindow function enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input.

Syntax:
code:
    BOOL EnableWindow(     

        HWND hWnd,
        BOOL bEnable
    );
Parameters:
  • hWnd
    [in] Handle to the window to be enabled or disabled.
  • bEnable
    [in] Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.

So, a good way to do it would be:
code:
Interop.Call("user32.dll", "EnableWindow", Wnd.Handle, false);
where Wnd is a valid ChatWnd object. ;)

As for your closing problem, make sure you call it right:
code:
function OnWndEvent_CtrlClicked(Wnd, Id) {
   if(Id == "BtnOk") {
      Wnd.Close(0); //The number doesn't really matter, but it's more common to just set it to zero
   }
}
Maybe it would be helpful if you post the code snippet where you call the Close function. :)

This post was edited on 12-06-2006 at 03:24 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-06-2006 03:23 PM
Profile E-Mail PM Web Find Quote Report
the andyman
Junior Member
**

Avatar
Windows Live Fanatic

Posts: 92
Reputation: 4
– / Male / Flag
Joined: Apr 2005
O.P. RE: Disable access to parent chat window when child xml window open
Thanks :), I'll have a play around with the info you've given me
The window disable works great (although if you go off the windows and then back to the conversation window the xml window isn't on top) but thanks anyway, I'm sure it's fine as it is (Y)

As for the closing problem this is basically what I've got:
code:
    function OnconfirmEvent_CtrlClicked(Wnd, Id){
    if(Id == "BtnYes"){
        // do other stuff I want it to do, then:
        return Message;
        Wnd.Close(0);
        Interop.Call("user32.dll", "EnableWindow", ChatWnd.Handle, true);
    }else{
        Wnd.Close(0);
        Interop.Call("user32.dll", "EnableWindow", ChatWnd.Handle, true);
        // do other stuff I want it to do, then:
        return false;
    }
}

This post was edited on 12-07-2006 at 06:58 PM by Tochjo.
12-06-2006 04:54 PM
Profile E-Mail PM Web Find Quote Report
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
RE: RE: Disable access to parent chat window when child xml window open
quote:
Originally posted by the andyman
code:
        return Message;
        Wnd.Close(0);
        Interop.Call("user32.dll", "EnableWindow", ChatWnd.Handle, true);


Code after the return will not be executed. Make that:
code:
        Wnd.Close(0);
        Interop.Call("user32.dll", "EnableWindow", ChatWnd.Handle, true);
        return Message;

12-06-2006 10:29 PM
Profile E-Mail PM Find Quote Report
the andyman
Junior Member
**

Avatar
Windows Live Fanatic

Posts: 92
Reputation: 4
– / Male / Flag
Joined: Apr 2005
O.P. RE: Disable access to parent chat window when child xml window open
Thanks, but the window is still not closing. I can't see any problem with it either :@
12-07-2006 06:17 PM
Profile E-Mail PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: RE: Disable access to parent chat window when child xml window open
code:
    function OnconfirmEvent_CtrlClicked(Wnd, Id){
    if(Id == "BtnYes"){
        // do other stuff I want it to do, then:
        return Message;
        Wnd.Close(0);
        Interop.Call("user32.dll", "EnableWindow", ChatWnd.Handle, true);
    }else{
        Wnd.Close(0);
        Interop.Call("user32.dll", "EnableWindow", ChatWnd.Handle, true);
        // do other stuff I want it to do, then:
        return false;
    }
}
Why do you want to return something anyway? The scripting documentation says it doesn't need a return value for the OnWndEvent_CtrlClicked event, so why would you? :P
Other than that, I don't actually see the problem... but where did you define that ChatWnd variable? ^o)

And also, do you have anything in your debugging window?

This post was edited on 12-07-2006 at 07:39 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-07-2006 07:39 PM
Profile E-Mail PM Web Find Quote Report
the andyman
Junior Member
**

Avatar
Windows Live Fanatic

Posts: 92
Reputation: 4
– / Male / Flag
Joined: Apr 2005
O.P. RE: RE: RE: Disable access to parent chat window when child xml window open
quote:
Originally posted by Mattike
Why do you want to return something anyway? The scripting documentation says it doesn't need a return value for the OnWndEvent_CtrlClicked event, so why would you? :P
because if one of the options is clicked in the xml windows then the message is send otherwise it isn't

quote:
Originally posted by Mattike
where did you define that ChatWnd variable? ^o)
in a function OnEvent_ChatWndSendMessage(ChatWnd, Message){ before the code I posted above

quote:
Originally posted by Mattike
And also, do you have anything in your debugging window?
I'm pretty sure I didn't before but now it does say that 'ChatWnd' is undefined, but only on the lines where I re-enable it :S. By the looks of it if I get that bit fixed then the whole thing should work (yn).
12-07-2006 08:53 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Disable access to parent chat window when child xml window open
quote:
Originally posted by the andyman
I'm pretty sure I didn't before but now it does say that 'ChatWnd' is undefined, but only on the lines where I re-enable it . By the looks of it if I get that bit fixed then the whole thing should work .

Remember to store the ChatWnd in a global variable (defined outside of a function, if you haven't already) else when you enter a different function it won't exist

This post was edited on 12-07-2006 at 09:40 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-07-2006 09:40 PM
Profile PM Find Quote Report
the andyman
Junior Member
**

Avatar
Windows Live Fanatic

Posts: 92
Reputation: 4
– / Male / Flag
Joined: Apr 2005
O.P. RE: RE: Disable access to parent chat window when child xml window open
quote:
Originally posted by SpunkyLoveMuff
Remember to store the ChatWnd in a global variable (defined outside of a function, if you haven't already) else when you enter a different function it won't exist
yeah I worked that out last night but thanks anyway

It does seem to be working properly now except only when I use the enter button to send a message, not the "Send" button :(

Also, is there any way to remove the text that is left in the text box in the conversation window?
12-08-2006 05:54 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Disable access to parent chat window when child xml window open
quote:
Originally posted by the andyman
yeah I worked that out last night but thanks anyway

It does seem to be working properly now except only when I use the enter button to send a message, not the "Send" button :(

You better post the entire script so all this can be checked upon properly. Because it sounds like you're doing some wrong thingie somewhere, maybe...

Also, what you actually want is making a dialog "modal". This means it will recieve all input until it closes and only then the "parent" window will be able to recieve input again. I doubt the EnableWindow API is the correct thing to use, that is: the only thing to use...

But I may be wrong in this (need todo some looking up).

quote:
Originally posted by the andyman
Also, is there any way to remove the text that is left in the text box in the conversation window?
Return an empty string from the ChatWndSendMessage event.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-08-2006 07:07 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« 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