What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Skype & Live Messenger » Multiple Sign-In locations question!

Multiple Sign-In locations question!
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Multiple Sign-In locations question!
One would assume that by subclassing the Chat Window and ignoring the WM_CLOSE message unless you were to type /close then that should work.

Obviously someone would need to write a DLL to subclass the windows but in theory the aforementioned pseudo should suffice for the situation.

If anyone wants to try the code out that I wrote by all means

Please note the following:
  • It is not recommended to do asynchronous callbacks in Plus! as the potential for collisions and crashes is higher
  • To my knowledge this has never been attempted and I posted without testing and therefore this could cause WLM to crash. Use at your own risk.
  • This is also only for testing purposes to see if my theory works. (Which as I am writing this it may not because your sent messages will show on both computers therefore typing /close will not work.)(I updated the code to close the Chat Window only when pressing the Escape key. This should prevent the other Chat Window from closing as well.)

js code:
/* Define object container */
var pChats = {};

/* Define script constants */
var WM_CLOSE = 0x0010;
var WM_KEYDOWN = 0x100;
var GWL_WNDPROC = (-4);
var VK_ESC = 0x11b;


/* Called when a Chat Window is created */
function OnEvent_ChatWndCreated(oChatWnd) {
    Subclass_ChatWnd(oChatWnd);
}

/* Called after we process the WM_CLOSE message */
function OnEvent_ChatWndDestroyed(oChatWnd) {
    Interop.Call('user32', 'SetWindowLongPtrW', pChat.Handle, GWL_WNDPROC, pChats[oChatWnd.Handle].WindowLongPtr);
    delete pChats[oChatWnd.Handle];
}

/* Called when a chat window is created to assign values to the object container */
function Subclass_ChatWnd(pChat) {
    pChats[pChat.Handle] = {
        ChatWnd : pChat,
        WindowLongPtr : Interop.Call('user32', 'GetWindowLongPtrW', pChat.Handle, GWL_WNDPROC),
        AllowClose : false
    }
    Interop.Call('user32', 'SetWindowLongPtrW', pChat.Handle, GWL_WNDPROC, Interop.GetCallbackPtr('CALLBACK'));
}

/* CALLBACK function */
function CALLBACK (hWnd, nMsg, wParam, lParam) {
    switch (nMsg) {
        case WM_CLOSE:
            if (pChats[hWnd].AllowClose === false) {
                return -1;
            }
            break;
        case WM_KEYDOWN:
            if (wParam === VK_ESC) {
                pChats[hWnd].AllowClose = true;
            }
    }
    Interop.Call('user32', 'DefWindowProcW', hWnd, nMsg, wParam, lParam);
}

This post was edited on 06-07-2010 at 02:42 PM by matty.
06-07-2010 01:40 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Multiple Sign-In locations question! - by M73A on 06-07-2010 at 12:49 PM
RE: Multiple Sign-In locations question! - by djdannyp on 06-07-2010 at 01:22 PM
RE: Multiple Sign-In locations question! - by matty on 06-07-2010 at 01:40 PM
RE: Multiple Sign-In locations question! - by M73A on 06-07-2010 at 03:12 PM
RE: Multiple Sign-In locations question! - by matty on 06-07-2010 at 03:51 PM
RE: Multiple Sign-In locations question! - by EG12 on 01-13-2011 at 11:52 AM
RE: Multiple Sign-In locations question! - by djdannyp on 01-13-2011 at 12:40 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