What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [help] destroying a window without crashing WLM

[help] destroying a window without crashing WLM
Author: Message:
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
O.P. [help] destroying a window without crashing WLM
I'm trying to destroy a window through the API (plus doesn't offer functions to do this), but either instantly or soner or later WLM crashes ...

I can hide/show windows, close them (this doesn't destroy them, just sorta minimizes them) and everything works fine.

code:
Hiding:
Interop.Call('user32','ShowWindow',Wnd.Handle, 0);

Showing:
Interop.Call('user32','ShowWindow',Wnd.Handle, 1);

Close(minimize):
Interop.Call('user32','CloseWindow',Wnd.Handle);

Destroy:
Interop.Call('user32','DestroyWindow',Wnd.Handle);

According to MSDN this is correct ...

Any ideas ?

Thanks
07-22-2006 04:37 PM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: [help] destroying a window without crashing WLM
Er...I do see "Close" method in PlusWnd Object, in the scripting documentation :)
07-22-2006 07:46 PM
Profile PM Web Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
RE: [help] destroying a window without crashing WLM
quote:
Originally posted by Mnjul
Er...I do see "Close" method in PlusWnd Object, in the scripting documentation :)
I don't think he wants to destroy a PlusWnd object, but I think he wants to destroy a window, other a window created by his script :)
YouTube closed-captions ripper (also allows you to download videos!)
07-22-2006 07:48 PM
Profile E-Mail PM Web Find Quote Report
cooldude_i06
Full Member
***

Avatar
I'm so cool I worry myself.

Posts: 272
Reputation: 9
– / Male / –
Joined: Sep 2003
RE: [help] destroying a window without crashing WLM
The PlusWnd::Close function destroys the window.

Syntax
code:
Close(
    [number] ExitCode
);
Parameters
ExitCode
[number] A number specifying the exit code for the window. It has no particular meaning for Messenger Plus! and can be anything the script's developer wishes it to be.
[Image: clb2.jpg]
07-22-2006 07:50 PM
Profile E-Mail PM Web Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
34 / Male / –
Joined: Jun 2004
RE: [help] destroying a window without crashing WLM
If you want to close a window that isn't created by your script, then the correct way would be to send it a WM_CLOSE message.
This lets it tidy up, and do anything it needs to before closing, however is you destroy the window straight away, it can't finish what it was doing, and quite often causes some crashing.
07-22-2006 07:52 PM
Profile PM Find Quote Report
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
O.P. RE: [help] destroying a window without crashing WLM
Yeah I should have said that it's not a PlusWnd that I want closed, but a conversation window one :P Sorry 'bout that.

@ Plik: Thanks I'm gonna try it :)
07-22-2006 07:59 PM
Profile PM Find Quote Report
Aeryn
Full Member
***

Avatar

Posts: 230
Reputation: 28
– / Female / –
Joined: Jun 2005
Status: Away
RE: [help] destroying a window without crashing WLM
Try:
code:
Interop.Call("User32", "SendMessageW", Wnd.Handle, 0x10, 0, 0);

0x10 is WM_CLOSE.

If that doesn't work then try SendMessage instead of SendMessageW.

Sometimes even this method crashes WLM though, but I'm not sure why. It should make the window do exactly what would happen if you pressed the X button.
07-22-2006 09:11 PM
Profile PM Find Quote Report
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
O.P. RE: [help] destroying a window without crashing WLM
I couldn't use WM_CLOSE directly (didn't work here), but I found this workaround that is working as expected:
code:
Interop.Call('user32','SendMessageW',wnd.Handle, 0x0112, 0xF060, 0)
0x0112 for system command
0xF060 for close

Thanks all
07-23-2006 03:19 AM
Profile PM Find Quote Report
Plan-1130
Full Member
***

I keep askin' myself: why?

Posts: 142
73 / Male / –
Joined: Feb 2005
RE: [help] destroying a window without crashing WLM
Even that last one crashes wlm...
Try using PostMessageW, instead of SendMessageW.
This will, unlike SendMessageW, not wait for the message to be processed, don't ask me why it works, but it does...

This post was edited on 11-16-2006 at 06:30 AM by Plan-1130.
My Scripts: UltimatFlooder, Advanced PSM Chat, PlusPrivacy, PlusRemote

[Image: Plan-1130.png]
10-14-2006 08:50 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