What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011

Pages: (3): « First « 1 [ 2 ] 3 » Last »
[Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
For stuff like checking what windows are created and which childs and parents there are, the well known developers tool Spy++ which comes with Visual Studio (or any other clone like Systree++) is essential.

Also see:
http://blogs.msdn.com/b/vcblog/archive/2007/01/16/spy-internals.aspx
http://blogs.msdn.com/b/vcblog/archive/2007/03/22/spy-update.aspx
if you're interested in how this tool works


----

To detect if tabbed chats is enabled the easiest would be to check that option's registry value. You can also check if the TabbedHostWndClass class exists. I see others already said this...

EDIT:
quote:
Originally posted by Matti
As for reading a REG_BINARY from the registry, you'll probably want to use some registry functions for that. Screenshot Sender 5 comes with a nifty set of registry functionalities which support REG_BINARY. Feel free to use that script file but please credit the original authors in a comment block at the top of the file.
You don't need to read it as a REG_BINARY if that binary string represents a DWORD (4 bytes). Just read it as a REG_DWORD in that case.

As such, a full blown registry libary for just checking 1 value is also very much over the top. Reading that registry key can also be done using the build-in regkey functions.

quote:
Originally posted by Domsy
Oh, wow, thanks! That's quite involved just to check for something that's not too crucial in my case, particularly if I'm going to be doing that every single event (not sure how heavy registry checks are)... May not be worth it...
Depends on what 'event' you mean. If it is just the OnEvent_ChatWndCreated function then there is nothing wrong with that. In fact, it would be essential to first check that registry key before you do anything else. Although it also highly depends if you can enable/disable tabbed chats in WLM 2011 on the fly though. If the user can only enable/disable it with a restart of WLM then doing the check in OnEvent_Initialize is sufficient, but if the user can change that setting whenever he wants you must always check the value before you do what you need to do (eg changing the icon of the chatwindow upon creation of that window).

And as said above, you don't need any library to check just one registry value. Use the build in functions in JScript for that.

quote:
Originally posted by Domsy
... except I can't seem to find a disable script command. Doh... Is there one?
You wont find one because you should not be disabling scripts! You should use programming logic (IF THEN ELSE) to control what your script should do (or not do).

This post was edited on 03-24-2011 at 11:04 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-24-2011 10:56 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
Disabling your script is not possible and is not such a great idea either. It's not up to the script to decide whether it should be enabled or not. Cookie's suggestion is much better. :)

quote:
Originally posted by CookieRevised
You don't need to read it as a REG_BINARY if that binary string represents a DWORD (4 bytes). Just read it as a REG_DWORD in that case.

As such, a full blown registry libary for just checking 1 value is also very much over the top. Reading that registry key can also be done using the build-in regkey functions.
I fully agree with you, but the RegRead function provided by WScript.Shell will return a VBArray of integers when reading from a REG_BINARY. It doesn't provide a way to override how the value is read, thus one will need to fall back on the Windows API functions to read as a different type. I don't know how a VBArray would look like in JScript though but it doesn't sound too great. :P

This post was edited on 03-24-2011 at 11:08 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
03-24-2011 11:08 PM
Profile E-Mail PM Web Find Quote Report
Domsy
Junior Member
**

Avatar

Posts: 31
35 / Male / Flag
Joined: Jun 2006
O.P. RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
Ok, wow, thanks for all the info.

My concern about 'every single event' was due to the fact I have to hook many events for my script to work: OnEvent_ContactStatusChange, _ContactSignin, _ContactSignout, and _ChatWndCreated. But yes, ChatWndCreated is probably the only event I actually need to do the registry check for. Cool! I can just do an unobtrusive toast notification, then, notifying the user the script won't function while tabbed chats is enabled.

Thanks very much! If it's ok with you, I'd like to send one/all of you my script when I'm done if you'd be willing to try it out, if you have the time? I'd appreciate your input! Also, you might actually find it really helpful; I don't know what I'd do without it now! (I've actually been using it since 2009!)
03-24-2011 11:10 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
You need to check the registry value each time because Microsoft allows the user to, in real time, disable and enable tabbed chats.
03-24-2011 11:17 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
quote:
Originally posted by Matti
quote:
Originally posted by CookieRevised
You don't need to read it as a REG_BINARY if that binary string represents a DWORD (4 bytes). Just read it as a REG_DWORD in that case.

As such, a full blown registry libary for just checking 1 value is also very much over the top. Reading that registry key can also be done using the build-in regkey functions.
I fully agree with you, but the RegRead function provided by WScript.Shell will return a VBArray of integers when reading from a REG_BINARY. It doesn't provide a way to override how the value is read, thus one will need to fall back on the Windows API functions to read as a different type. I don't know how a VBArray would look like in JScript though but it doesn't sound too great. :P
Correct though (I forgot there was no second parameter to specify the type when you read a key). However, there is nothing difficult about a VBArray. In fact using toArray() is all it takes to convert it.

Javascript code:
try {
    var oShell = new ActiveXObject("WScript.Shell");
    var bTabsEnabled = oShell.RegRead("HKCU\\Software\\Microsoft\\MSNMessenger\\PerPassportSettings\\" +  Messenger.MyUserID + "\\DisableTabs");
    bTabsEnabled = new Boolean(bTabsEnabled.toArray().join(""));
} catch(e) {
    var bTabsEnabled = false;
}

the join is just a trick to join all 'integers' elements together like a string to form one number (it doesn't matter what the joined value would be, since we're only interested in true or false, or "0000" or not "0000".

Note that new Boolean(bTabsEnabled.toArray()[0]) could also be used, but then again, that wont work when the binary value would be something like '00 00 33 00'.



This post was edited on 03-24-2011 at 11:31 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-24-2011 11:26 PM
Profile PM Find Quote Report
Domsy
Junior Member
**

Avatar

Posts: 31
35 / Male / Flag
Joined: Jun 2006
O.P. RE: RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
quote:
Originally posted by matty
You need to check the registry value each time because Microsoft allows the user to, in real time, disable and enable tabbed chats.
Good point. I did just notice this myself while I was testing, and unfortunately no events get fired when the setting is changed.

However, because of how I've structured my code, I can keep the registry check being done only when absolutely required. For instance, it would only ever need to be fired on a contact sign-in event, for example, if a conversation is open with that user.

This should be fine! All I have to do now is figure out how I should be reading this value ;) Fun!

Edit:
quote:
Originally posted by CookieRevised
Correct though (I forgot there was no second parameter to specify the type when you read a key). However, there is nothing difficult about a VBArray. In fact using toArray() is all it takes to convert it.

Javascript code:
try {
    var oShell = new ActiveXObject("WScript.Shell");
    var bTabsEnabled = oShell.RegRead("HKCU\\Software\\Microsoft\\MSNMessenger\\PerPassportSettings\\" +  Messenger.MyUserID + "\\DisableMSNToday");
    bTabsEnabled = new Boolean(bTabsEnabled.toArray().join(""));
} catch(e) {
    var bTabsEnabled = false;
}


Oh wow, ok, I guess you did it for me. Thanks! Lol! I had never expected this much help today. I really appreciate it, everyone :)

This post was edited on 03-24-2011 at 11:31 PM by Domsy.
03-24-2011 11:27 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
PS: note that I my example code I used
"DisableMSNToday" instead of "DisableTabs" (for testing purposes). So make sure you edit it to the correct key :p
I've edited my previous post....

This post was edited on 03-24-2011 at 11:39 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-24-2011 11:33 PM
Profile PM Find Quote Report
Domsy
Junior Member
**

Avatar

Posts: 31
35 / Male / Flag
Joined: Jun 2006
O.P. RE: RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
quote:
Originally posted by CookieRevised
PS: note that I my example code I used
"DisableMSNToday" instead of "DisableTabs" (for testing purposes). So make sure you edit it to the correct key :p
I've edited my previous post....
Yep, thanks! I did notice, hehe. I was taking the code as advice rather than a complete copy-paste (I'm not actually as hopeless as I'm seeming in this thread, LOL! :D)

I think we also need to check ShowConvWndTabs anyway, right? ;)

This post was edited on 03-24-2011 at 11:46 PM by Domsy.
03-24-2011 11:38 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
quote:
Originally posted by Domsy
My concern about 'every single event' was due to the fact I have to hook many events for my script to work: OnEvent_ContactStatusChange, _ContactSignin, _ContactSignout, and _ChatWndCreated.
in that case you must check the value in each and every event!
Because between contact status changes for example, the user could have enabled/disabled tabbed chatting. In essence, you need to check the value each time your script manipulates (sets) the icon!!

This said, depending on what your script _exactly_ does, and how WLM 2011 _exactly_ uses its container windows and what the function is of that other key (ShowConvWndTabs) - can't check, I don't run WLM 2011 atm- it may also be possible to simply forget about checking those registry keys, and simply check if the container window, for which you want to manipulate the icon, exists (which you should do anyways or your icon APIs might fail). It might be enough.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-24-2011 11:41 PM
Profile PM Find Quote Report
Domsy
Junior Member
**

Avatar

Posts: 31
35 / Male / Flag
Joined: Jun 2006
O.P. RE: [Resolved] Interop.Call SendMessageW not working since Plus 5/WLM 2011
quote:
Originally posted by CookieRevised
in that case you must check the value in each and every event!
Because between contact status changes for example, the user could have enabled/disabled tabbed chatting. In essence, you need to check the value each time your script manipulates (sets) the icon!!
Yep! Luckily, I did a main function that does this so I just need to modify that rather than each event :) Of course, you'd be expecting that of me anyway, hehe.

I think there will be a slight issue if someone is to disable tabbed chats with conversations already open. No matter what, they'll all revert to the default icon and won't change until there's a relevant event update. I don't think I can avoid this, but it's no biggie... I don't expect tabbed chats to be enabled and disabled constantly all the time! It should be a one-time issue, and it's not disastrous anyway, hehe.

This, luckily, doesn't apply to enabling tabbed chats as well, as the icon gets replaced with the default.

Edit (crazy quote madness! lol):
quote:
Originally posted by CookieRevised
This said, depending on what your script _exactly_ does, and how WLM 2011 _exactly_ uses its container windows and what the function is of that other key (ShowConvWndTabs) - can't check, I don't run WLM 2011 atm- it may also be possible to simply forget about checking those registry keys, and simply check if the container window, for which you want to manipulate the icon, exists (which you should do anyways or your icon APIs might fail). It might be enough.
Oh! Yes, I was wondering that myself... Ahhhhh! I'll investigate. I guess Spy++ should be handy (thanks for that! I have it with Visual Studio but have never used it).

Edit 2:
Looks like when you have tabbed chats disabled, every single conversation has it's own tab container (class: TabbedHostWndClass) whereas if tabbed chats is enabled, there's only one of them, which holds all the actual conversation windows (IMWindowClass).

As far as I can tell, from that, it won't be of any help as you can't determine, this way, if tabbed chats is enabled or not unless you have more than one window, and it would be awkward to figure out anyway. I guess the registry option is the only way! (Unless I've missed something, which is probable, lol).

Edit 3:
All done! Works great so far! Thanks for all the help :)

A little modification I had to make. It didn't seem to like the "new Boolean()" thing, and I had to typecast the join result as a Number. Ended up with:
code:
bTabsEnabled = (Boolean)((Number)(reg.toArray().join('')));
Without the typecasting, I think it was using a string literal of "0000".

Thanks! Any of you willing to try it out before I make an attempt at releasing at some point? :)

This post was edited on 03-25-2011 at 12:57 AM by Domsy.
03-24-2011 11:46 PM
Profile PM Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« 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