Shoutbox

[Developers] Modifying menu button control menus - 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: [Developers] Modifying menu button control menus (/showthread.php?tid=75676)

[Developers] Modifying menu button control menus by deAd on 06-26-2007 at 10:26 PM

Warning: the technique used in this example is built for Messenger Plus! Live 4.23.0.276. It may not work on other versions of Plus!. There is a safety check in the code, but if you are unsure about using this you should wait for Patchou to add functions to change the menus (hint hint :P) to the scripting API (which might never happen).


It is possible to retrieve a menu handle from a menu button control. This handle can be passed to the Win32 menu functions in order to get information or modify the menu attached to the menu button control. However, you have limitations when using this handle. If you add new menu items, they will stand out because they are not painted by Plus! unless they have the MF_OWNERDRAW flag. If you set this flag, Messenger will crash (Plus! will probably be missing some necessary information). There is a way around this but I'm not going to try and find it because it can make this hack even more version specific. I have not tested removing menus (I would guess that it would work but cause a small memory leak unless done carefully because of a structure of extra data usually used with owner drawn menus), but I would recommend you don't attempt this.

I have tested this by setting the check state and the disabled state of existing menu items. I have also added menu items (doesn't work well), but I have not removed items or tried to change their text. Enabling and disabling items will not change their appearance (they do not appear grayed).

I have attached a commented sample script that shows how to retrieve and use this menu handle.

Use carefully and enjoy :p
RE: [Developers] Modifying menu button control menus by warmth on 06-26-2007 at 10:30 PM

:O what a nice job... ;)!