Shoutbox

[Thx] DestroyWindow on chatwindow = crash? - 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)
+----- Thread: [Thx] DestroyWindow on chatwindow = crash? (/showthread.php?tid=72937)

[Thx] DestroyWindow on chatwindow = crash? by Flash on 03-23-2007 at 11:39 PM

All in title :P


RE: DestroyWindow on chatwindow = crash? by deAd on 03-24-2007 at 12:12 AM

Don't use DestroyWindow anyways, it doesn't give a chance for the window to clean up. Instead, you have quite a few options:

  1. Send "/close" to the chat window (not recommended because it shows up in the recent messages list and won't work if commands are disabled)
  2. Send a WM_COMMAND message with the menu identifier of the Close menu item
  3. Send a WM_CLOSE message
  4. Call CloseWindow on the chat window - this doesn't close it, nevermind[/list]

    The WM_CLOSE method is probably the best to use :)

RE: DestroyWindow on chatwindow = crash? by Flash on 03-24-2007 at 05:29 PM

1- Pluswnd.Sendmessage work with chatwnd?
2- what the value of WM_close?


RE: DestroyWindow on chatwindow = crash? by deAd on 03-24-2007 at 05:54 PM

Here's code to do each way (I'm bored :P). I recommend you use the last one ;)

  1. Send "/close" to the chat window (not recommended because it shows up in the recent messages list and won't work if commands are disabled)
    code:
    pChatWnd.SendMessage('/close');
  2. Send a WM_COMMAND message with the menu identifier of the Close menu item
    code:
    Interop.Call('User32.dll', 'SendMessageW', pChatWnd.Handle, 0x111 /* WM_COMMAND */, 40017, 0);
  3. Send a WM_CLOSE message
    code:
    Interop.Call('User32.dll', 'SendMessageW', pChatWnd.Handle, 0x0010 /* WM_CLOSE */, 0, 0);
    [/list]

RE: DestroyWindow on chatwindow = crash? by Flash on 03-24-2007 at 06:21 PM

aaaaaah thx its the W i missed SendMessageW lol and thx for the value


RE: DestroyWindow on chatwindow = crash? by CookieRevised on 03-24-2007 at 11:49 PM

quote:
Originally posted by Flash26
aaaaaah thx its the W i missed SendMessageW lol and thx for the value
The W stands for "Wide".

Many APIs come in two versions, and ascii version and a wide version. This is for when you send text (or rather a handle to a text string in memory), since text can either be pure ascii or unicode (=wide characters =characters which are build from more than 1 byte... eg: Japanees, Hebrew, etc)

For sending a close command or close message it doesn't matter what you use since those commands and/or messages are numeric. So you could also use: "SendMessageA".

Such info like this can easly be found in the MSDN library

;)
RE: [Thx] DestroyWindow on chatwindow = crash? by Flash on 03-25-2007 at 12:41 AM

ok thx, but i can use all time W?


RE: [Thx] DestroyWindow on chatwindow = crash? by CookieRevised on 03-25-2007 at 12:47 AM

quote:
Originally posted by Flash26
ok thx, but i can use all time W?

Yes, you can use the 'wide' version all the time with numeric messages or commands which do not return strings or which don't have anything todo with strings (eg: thus not commands or messages which return the amount of bytes in a string either).

No, you can't use the 'wide' version if you are going to pass a handle to an ascii string as a parameter or if the function will return a handle to an ascii string (which can also be the result of a numeric send message).
RE: [Thx] DestroyWindow on chatwindow = crash? by Flash on 03-25-2007 at 12:49 AM

ok master :P
cookie u can help me for this
http://shoutbox.menthix.net/showthread.php?tid=72970