What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Global Window-handler possible?

Global Window-handler possible?
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Global Window-handler possible?
Ok, sorry it has been a couple of weeks since I have done some scripting so I didn't read it all that well.

Unfortunately you can't create the one function to the best of my knowledge except by using notifications from the win32 API.  The biggest issue with this is that you will probably need to use a 3 dimensional array so that you have the handle for each window and then each element within the window (which then obviously can use a lot of memmory in large cases and would either require reading the XML for the window or hard coding each element for each window).

Personally I think this will take more code and will be less effective.  The whole idea of using multiple functions is because each window has different features and hence different requirements.

What you might want to do instead is something like the following:

code:
function OnWindowEvent_CtrlClicked(PlusWnd,CntrlId){
switch(CntrlId){
case "first": callCommonFunction(PlusWnd.Handle);
case "second" : callAnotherFunction();
}
}

function OnYetAnotherWindowEvent_CtrlClicked(PlusWnd,CntrlId){
switch(CntrlId){
case "first": callCommonFunction(PlusWnd.Handle);
case "third" : callYetAnotherFunctionWhichInstAbove();
}
}

function callCommonFunction(oHandle){
Interop.Call("User32.dll", "MessageBoxW", oHandle, "Hello!", "Example Message", 0); // Either window will have this message displayed on top
}

I know this isn't exactly what you are looking for, but it is probably the best solution I can think of off of the top of my head.


Also, I can understand the OOP, but it is more complex than you need to make it.  The likes of iTunes+ and NowPlaying are two scripts that use objects effectively and are much easier to read imho (it might just be those underscores that are doing it to me and the lack of spaces due to the forum).  This is purely my own opinion though, I'm not saying you have to code the way I like, I was just making a recommendation.  I don't think there is any reason why you should need to make things complex in such a nice and basic language :tongue:
[Image: markee.png]
06-03-2008 12:42 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Global Window-handler possible? - by RdeWilde on 06-03-2008 at 10:20 AM
RE: Global Window-handler possible? - by markee on 06-03-2008 at 10:56 AM
RE: Global Window-handler possible? - by RdeWilde on 06-03-2008 at 11:23 AM
RE: Global Window-handler possible? - by markee on 06-03-2008 at 12:42 PM
RE: Global Window-handler possible? - by RdeWilde on 06-03-2008 at 02:28 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