Prevent closing chats? - 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: Prevent closing chats? (/showthread.php?tid=65011) Prevent closing chats? by Jesus on 08-16-2006 at 12:55 PM
Hi all, RE: Prevent closing chats? by RaceProUK on 08-16-2006 at 02:09 PM I know how to do this, but it requires a DLL and a keyboard hook. RE: Prevent closing chats? by Jesus on 08-16-2006 at 04:17 PM hmm I've never done that... is it hard to do? RE: Prevent closing chats? by RaceProUK on 08-17-2006 at 08:31 AM Not massively really. If you like, I can post some code later today for you to look at. RE: Prevent closing chats? by CookieRevised on 08-17-2006 at 08:34 AM
quote:to intercept ALT-F4... But what about all the other ways you can close a chat? Isn't it better to hook the window and intercept the close window message? RE: RE: Prevent closing chats? by Jesus on 08-17-2006 at 08:39 AM
quote:that would be great RE: Prevent closing chats? by RaceProUK on 08-17-2006 at 08:46 AM
quote:I actually intercept Escape. As for the message, the window still wants to be able to be closed, so some sort of special logic will be needed to handle it. RE: Prevent closing chats? by Delphi Thunderbolt on 08-17-2006 at 01:45 PM
A better way would be to intercept the actual windows API message that closes the window (WM_CLOSE, or something like that; Use a program like MessageSpy++ to find out). RE: Prevent closing chats? by Jesus on 08-17-2006 at 02:55 PM Well I'm not afraid to (try to) learn something, so I'll take a look at it. RE: Prevent closing chats? by Delphi Thunderbolt on 08-18-2006 at 05:10 AM
quote: Heh, it only took me (*counts on fingers, mumbles and adds numbers*) 12 months to learn it and code (or look for code) it RE: Prevent closing chats? by Jesus on 08-26-2006 at 12:46 PM
Am I right that dscwpmsg.dll from this thread can do what I want? RE: Prevent closing chats? by Jesus on 09-09-2006 at 03:22 PM
*bump* RE: Prevent closing chats? by Delphi Thunderbolt on 09-10-2006 at 01:41 AM
It would be better if you looked for the API message that closes the window (Most likely WM_NCCLOSE) and cancel it out. code: Like I said before, it's not going to be easy initially, but it's quite easy to understand and it's well worth the effort. RE: Prevent closing chats? by Jesus on 09-10-2006 at 11:01 AM
Well the message to be cancelled is WM_DESTROY, which I found using Winspector Spy. So I went looking for a way to hook the chat window. I found the mentioned thread and started looking into it. code:it returns 0... quote: RE: Prevent closing chats? by Plik on 09-10-2006 at 11:26 AM
quote:You probably want to cancel WM_CLOSE and not WM_DESTROY Because WM_CLOSE is the message that is sent to a window to tell it to start closeing, and this lets the window clean up and do anything it needs todo when its closed (for example in a group conversation it shows the prompt dialog when you send WM_CLOSE). However WM_DESTROY is what is sent when the window actually needs to be destroyed, usually after WM_CLOSE has been sent, and the window has had time to clean up. So if you only canceled WM_DESTROY then the window would still do all the closeing it needs todo (like ending sessions) but the window would just never get destroyed. So you need to possible cancel both. Hope this makes some sense RE: Prevent closing chats? by Jesus on 09-10-2006 at 11:59 AM that makes sense indeed, the only problem is that I don't see any WM_CLOSE messages in the window's message list (screenshot) RE: Prevent closing chats? by xxhannahxx on 09-10-2006 at 12:30 PM
i know someone that could make this for you probally RE: Prevent closing chats? by CookieRevised on 09-10-2006 at 03:00 PM
jesus, there are many different kind of hooks and methods. And for each specific thing you want to do you need different kinds and different approaches. You can't base your code on some listing which does something completely different (refering to the thread you listed). quote:That code actually doesn't help at all or has not much todo with this. The code is a build-in event in Delphi and many more languages to trap the closing of a window which was created by that same code. No hooking involved at all. you can't use it, nor any parts of this. RE: Prevent closing chats? by Delphi Thunderbolt on 09-11-2006 at 10:38 AM
Yeah, sorry there. Just realised it after re-reading the code. RE: Prevent closing chats? by Jesus on 09-11-2006 at 05:33 PM thanks for the replies, I know a bit of VB programming so I'll try it with the help of the links and info you all provided me. |