What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » A few questions.

Pages: (2): « First [ 1 ] 2 » Last »
A few questions.
Author: Message:
Emblem
New Member
*

Avatar

Posts: 7
32 / Male / Flag
Joined: Jan 2007
O.P. A few questions.
Okay, so I'm about to attempt a script that will be quite a challenge. But once I'm done coding it, the final result will be amazing.

But to create this script I need to expand my knowledge, so I present the following questions:

  • Is it possible to draw on the Chat window? (Using GDI+ or something.)
  • Is there any way to display a right click menu? (Anywhere, not just on a Plus! Window.)
  • Is it possible to find out what font settings the currently signed in user is using?

Thanks in advance.

Edit:
I thought I'd expand upon my request, because I kind of expect people to shrug this off as a "He's new, he doesn't know what he's doing." thread.

I'm pretty sure the first two are possible using complex introp calls (which I'm willing to learn how to do, because this project is worth it.)

But, looking through the scripting documentation it appears that the font settings aren't retrievable. So I'm hoping that maybe messenger stores the font in the register, and I can access it that way.

To expand on the font request a bit more: I only need the current users font, and I only need to read it. I don't need to change it.

This post was edited on 05-02-2010 at 03:35 AM by Emblem.
The ninja coder.
05-02-2010 03:29 AM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: A few questions.
quote:
Originally posted by Emblem
Is it possible to draw on the Chat window? (Using GDI+ or something.)
I'm afraid that's going to be a nasty one. I think you can retrieve the device context of the window and I think you can then draw on it, but the problem is that windows are very complex objects and drawing on them using low-level GDI will most certainly cause trouble. You're going to need to find a way to redraw your additions every time the chat window needs repainting and even if you manage to do that, it'll probably be over-painted by the controls in the window.

I've seen some scripts trying to draw stuff on chat windows, but none of them managed to do this perfectly in all possible situations. Those scripts used a PlusWnd which is set as child window of the chat window and then positioned. Afterwards, they can reposition it in case the chat window is resized.

The first problem is that this repositioning has to be invoked using a timer, the script can't register an event for when the chat window is resized so it has to do this every x seconds which can cause flickering while resizing.

However the biggest problem is that it's not skin-proof. Every Messenger skin looks different and most of them have their elements in other positions than the default skin. Positioning the child window requires specific client coordinates and thus if it looks fine in one skin, it probably won't in another skin.
quote:
Is there any way to display a right click menu? (Anywhere, not just on a Plus! Window.)
Sure, you can use CreatePopupMenu, populate it with menu items and then show it using TrackPopupMenu. I needed this functionality for one of my own scripts, so I made a nice wrapper class for it (see attachment). Just create a new Menu instance, use AddMenuItem() to add items and use Open() to pop it up somewhere on the screen.

This Menu class is taken straight from the current beta of Screenshot Sender 5, documentation is in the script file itself. If you need to add images in front of the menu items, you're going to have to import the function GdiCreateHBITMAPFromFile() and its dependencies from Countdown Live 2 or Screenshot Sender 5.
quote:
Is it possible to find out what font settings the currently signed in user is using?
I think they're somewhere in the registry, try searching these forums.

.txt File Attachment: __menu.js.txt (26.08 KB)
This file has been downloaded 219 time(s).
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
05-02-2010 08:33 AM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: A few questions.
quote:
Originally posted by Matti
quote:
Is there any way to display a right click menu? (Anywhere, not just on a Plus! Window.)
Sure, you can use CreatePopupMenu, populate it with menu items and then show it using TrackPopupMenu. I needed this functionality for one of my own scripts, so I made a nice wrapper class for it (see attachment). Just create a new Menu instance, use AddMenuItem() to add items and use Open() to pop it up somewhere on the screen.

This Menu class is taken straight from the current beta of Screenshot Sender 5, documentation is in the script file itself.

This works perfectly for a Plus! window which you can subclass in Plus!, but does this also work for any other window (eg: a conversation window, as that is what he is asking) which you can not subclass in Plus! scripting?

A very long time ago (before SSS), I did the same: A quick 'n dirty rough test showed that creating (and even showing the context menu) worked fine, but there was no way to detect a click because you couldn't subclass the window which would receive the clicked menu IDs (I tested this on the main contact list iirc).

At least, that was a long time ago without too much looking into it (it was a very quick test), and as far as I can remember so I dunno...



quote:
Is it possible to find out what font settings the currently signed in user is using?
HKEY_CURRENT_USER\Software\Microsoft\MSNMessenger\PerPassportSettings\<the MSNID of the user>\IM Format

However, this can not be changed on the fly. Messenger only checks this when opening or changing the font via its own UI (so I suppose you could maybe force it to reload or something by patching it in memory/invoking its internal routines or something. But that is not for the fainth of heart.)

This post was edited on 05-05-2010 at 07:58 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-03-2010 11:00 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: RE: A few questions.
quote:
Originally posted by CookieRevised
This works perfectly for a Plus! window which you can subclass in Plus!, but does this also work for any other window (eg: a conversation window, as that is what he is asking) which you can not subclass in Plus! scripting?

A very long time ago (before SSS), I did the same: A quick 'n dirty rough test showed that creating (and even showing the context menu) worked fine, but there was no way to detect a click because you couldn't subclass the window which would receive the clicked menu IDs (I tested this on the main contact list iirc).

At least, that was a long time ago without too much looking into it (it was a very quick test), and as far as I can remember so I dunno...
Indeed, you need a subclass window to receive those notifications, but I believe this can be done using a simple Plus! window created solely for that purpose. In Screenshot Sender 5, we use the following interface:
xml code:
<Window Id="Subclass" Version="1">
    <Attributes><ShowInTaskbar>false</ShowInTaskbar></Attributes>
    <Position Width="0" Height="0"/>
    <DialogTmpl/>
</Window>
When the popup menu has to be opened, we create the subclass window (if not already created) and pass its handle as hWnd. As MSDN puts it: this window receives all messages from the menu. Therefore, it should not make any difference whether the menu was opened because of an event in a chat window or in a Plus! window or any other source. There's no need to subclass the chat window itself, any window will do, including Plus! windows.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
05-03-2010 04:02 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: A few questions.
yes, ok, that is if you create the menu starting from your own (a Plus!) window. Aka you have a way to know when and where to display it. But how do you detect a right mouse click on the chat window without subclassing the chat window? AFAIK, you can't...

You hav 2 possebilities as far as I can see atm:

1) or you start from your own window. Then you can indeed detect clicked menu items because the menu belongs to your own subclassed window.
(is what you're saying)

But then you'r stuck because you have no (decent) way to know where and when to show the menu with TrackPopupMenu in the first place, as you can't detect mouse clicks (in a decent not-polling way) on another window because its window messages are send to that other window.

2) or you alter the menu from the chat window itself to include your custom menu items too (very easy to do). But then you're stuck once again because you can't detect it when the user selects the items. Again because you can't subclass that window and detect your custom menu IDs.
(is what I've quickly 'tested' before)

-------

On the other hand I might be missing something obvious here though....

This post was edited on 05-04-2010 at 06:25 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-04-2010 05:05 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: A few questions.
My apologizes, I think I misunderstood your initial point. I assumed that you were saying it wasn't possible to detect a click on an item in the created menu. I think you meant that it wasn't possible to detect a click in the chat window and use that event as a trigger for a pop-up menu. :)

If so, then I completely agree with your point. You need a way to subclass the chat window in order to receive notifications and have a way to react upon them (such as opening a menu). This is indeed not possible with pure Plus! scripting at the moment.

Injecting your own entries in the chat window's pop-up menus is another option indeed, but as you correctly state this will get you into even more trouble than using your own menus.

Perhaps a clever programmer could do some magic by modifying the process code directly (but I doubt that would be easy/effective), however the only possibility I see is to throw in an external DLL to subclass the window. This requires a fair amount of knowledge of C++ or Visual Basic or whatever native language you like, which even I don't have - I'm more a C# and scripting guy. :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
05-04-2010 06:15 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: A few questions.
Yup, an external DLL (Native, ActiveX, .NET, whatever)  is the only way at the moment afaik.

Luckally, as you have seen, MnJul has shared a technique which will let you grab Plus! objects directly from your DLL.

So you don't even need a temporary Plus! window anymore either as a kind of man-in-the-middle* to talk to your DLL if you want to manipulate or fire Plus! events.

*This man-in-the-middle technique was also used with the SendTo script for example. The external DLL simply sends a message to a Plus! window, which is a small (1x1px) hidden window dedicated only for this and subclassed by the Plus! script. And the Plus! script on its turn comes in action when it detects a new message on this Plus! window and does what it is suppose to do.

--------------------------

This only leaves the drawing on the chat window problem. Which is, afaik, almost impossible to do in a proper way....
(It is possible though, prooven by Plus! itself, but it would require a hell of a lot of very advanced programming, which nobody but Patchou has mastered to do in a proper reliable way... -damn him and his secrets :p-)

This post was edited on 05-04-2010 at 06:36 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-04-2010 06:32 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: A few questions.
quote:
Originally posted by CookieRevised
This only leaves the drawing on the chat window problem. Which is, afaik, almost impossible to do in a proper way....
(It is possible though, prooven by Plus! itself, but it would require a hell of a lot of very advanced programming, which nobody but Patchou has mastered to do in a proper reliable way... -damn him and his secrets :p-)

Which stuff is manually draw by Plus! on chat windows? Isn't all the custom Plus! stuff just done by modifying the uifiles and letting WLM handle the drawing?
05-04-2010 06:51 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: A few questions.
Yep... that's exactly the advanced programming I mean.

I didn't say manually drawing all the stuff yourself though. That is completely undoable (even for a C++ god like Patchou). Handling simple owner-drawn objects is already hard enough, let alone a whole chat window from another program. You probably end up making your own client :p

But showing graphics, dynamically injected in certain places in the UIFiles, is doable... as Plus! does it...

This post was edited on 05-04-2010 at 07:06 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-04-2010 07:01 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: A few questions.
Yeah that does seem like it would be amazingly difficult (if not impossible) to do from a script.

Assuming the way that Plus! modifies them is by using detours to proxy resource loading functions (LoadResource etc.), then a script would need to also do this, correct? I'm guessing it also would depend on the order in which things are loaded. If WLM has already loaded uifiles before Plus! has initialised scripts then our poor scripts don't stand a chance of doing this :P

It's also important to note this isn't something which can really be done "on-the-fly". You have to restart messenger for any of the uifiles to be reloaded. It really does seem messy to be modifying Messenger like this from a script...

Would it be easier to create custom buttons using a skin with certain cmdids that you could then process by subclassing the window?
05-04-2010 07:47 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » 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