What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Prevent closing chats?

Prevent closing chats?
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Prevent closing chats?
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).


What you in the first place need to prevent closing of a window is subclassing. You need to trap WM_CLOSE in the window's windows messages stream.

This means that you will need to redirect the windows messages stream (often called the 'WindowProc') to a function in your program (note: this can not be done in JScript) with a callback function.

In that callback function you simply pass thru all the messages the window will recieve (which are a massive load) to the default WindowProc. Only when WM_CLOSE is detected your callback function must not do anything and thus will effectivly cancel this windows message out.

To subclass a window all you need to do is to change its main window proc address to the address of your callback function so that is called instead. (and in your callback procedure calls the original windowproc procedure of the Window).

An easy (VB6) example explaning all this: http://www.osix.net/modules/article/?id=653



However, you probably also need a system wide or application wide hook to know when a window is opened, so you can get its handle and subclass it. (you could also use a timed loop for this to poll for any newly opened windows, so you don't need a hook at all, but that is rather a more crappy way of doing it imho).

Or if you're writing a DLL to be loaded in a Plus! script, you can of course simply use the Plus! scripting event ChatWndCreated to pass the handle of the chat window to your DLL which on its turn subclass that chat window.

quote:
Originally posted by Delphi Thunderbolt
I grabbed this from a Delphi forum, which you could probably use in a DLL and call the function from your script. Take note of the bolded pieces of code.
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.

This post was edited on 09-10-2006 at 03:15 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
09-10-2006 03:00 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Prevent closing chats? - by Jesus on 08-16-2006 at 12:55 PM
RE: Prevent closing chats? - by RaceProUK on 08-16-2006 at 02:09 PM
RE: Prevent closing chats? - by Jesus on 08-16-2006 at 04:17 PM
RE: Prevent closing chats? - by RaceProUK on 08-17-2006 at 08:31 AM
RE: RE: Prevent closing chats? - by Jesus on 08-17-2006 at 08:39 AM
RE: Prevent closing chats? - by CookieRevised on 08-17-2006 at 08:34 AM
RE: Prevent closing chats? - by RaceProUK on 08-17-2006 at 08:46 AM
RE: Prevent closing chats? - by Delphi Thunderbolt on 08-17-2006 at 01:45 PM
RE: Prevent closing chats? - by Jesus on 08-17-2006 at 02:55 PM
RE: Prevent closing chats? - by Delphi Thunderbolt on 08-18-2006 at 05:10 AM
RE: Prevent closing chats? - by Jesus on 08-26-2006 at 12:46 PM
RE: Prevent closing chats? - by Jesus on 09-09-2006 at 03:22 PM
RE: Prevent closing chats? - by Delphi Thunderbolt on 09-10-2006 at 01:41 AM
RE: Prevent closing chats? - by Jesus on 09-10-2006 at 11:01 AM
RE: Prevent closing chats? - by Plik on 09-10-2006 at 11:26 AM
RE: Prevent closing chats? - by Jesus on 09-10-2006 at 11:59 AM
RE: Prevent closing chats? - by xxhannahxx on 09-10-2006 at 12:30 PM
RE: Prevent closing chats? - by CookieRevised on 09-10-2006 at 03:00 PM
RE: Prevent closing chats? - by Delphi Thunderbolt on 09-11-2006 at 10:38 AM
RE: Prevent closing chats? - by Jesus on 09-11-2006 at 05:33 PM


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