Developers heart felt wish! - 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 heart felt wish! (/showthread.php?tid=81472) Developers heart felt wish! by matty on 02-05-2008 at 08:52 PM
Patchou please we beg of you; implement callbacks into Plus! Scripting. code: RE: Developers heart felt wish! by vikke on 02-05-2008 at 09:10 PM There could be problems with the parameters, because they are different (both count and size) depending on what callback you're using (or if you create your own). I don't know if it's possible in some way to solve this (well it could work if you pass parameters to the CreateCallback() method of the MsgPlus object). RE: Developers heart felt wish! by Patchou on 02-05-2008 at 10:10 PM matty, it's just not that simple you see... scripting functions are very different than native function. Please post back and give me a list of function for which you would need a callback, I'll try to work on something. RE: Developers heart felt wish! by matty on 02-05-2008 at 11:37 PM
Well my preference would be all of them because that would make the scripting engine complete as far as Win32 API support. RE: Developers heart felt wish! by Patchou on 02-06-2008 at 07:51 PM Please give me the one thing I asked you to provide. I only need you to give me a list of functions you plan on using with callbacks so that I can check them out (for things like calling conventions). Thank you. RE: Developers heart felt wish! by CookieRevised on 02-06-2008 at 08:24 PM
Aren't most (if not all) callback functions in the form of: code:Making it almost the same as OnWindowidEvent_MessageNotification??? Using this 'convention'/method you would have covered almost all callbacks... (By heart I only know of only 1 callback function which uses 1 more parameter; WindowProc) Interpreting what the parameters are (just a number or a pointer to something else) is the responsebility of the scripter, imho, just like with OnWindowidEvent_MessageNotification (?) /me sits beside Matty on his knees begging RE: Developers heart felt wish! by matty on 02-06-2008 at 08:33 PM
EnumWindows (callback: EnumWindowsProc) quote: Using the many params was just to make sure all were covered WndProc who cares about we don't need Plus! scripting to subclass Windows thats just too much access to the system. RE: Developers heart felt wish! by Eljay on 02-06-2008 at 08:35 PM
http://allapi.mentalis.org/apilist/e.shtml RE: Developers heart felt wish! by Patchou on 02-06-2008 at 08:50 PM
Alrighty, thanks for the info. You'll have it in 4.51 . RE: Developers heart felt wish! by Eljay on 02-06-2008 at 08:55 PM
quote: RE: Developers heart felt wish! by matty on 02-06-2008 at 08:56 PM
you are the man! RE: Developers heart felt wish! by Patchou on 02-06-2008 at 09:04 PM
* Patchou wonders too.... RE: Developers heart felt wish! by aNILEator on 02-06-2008 at 11:54 PM and fix some skinny stuff to <3 :-> RE: Developers heart felt wish! by vikke on 02-08-2008 at 02:46 PM
What about SetWindowLong and SetWindowsHook? I want callbacks for those. code:Mostly compilers use the __cdecl calling convention by default (C/C++ compilers). So the compiler would read it as: code:If you change calling convention to, let's say, __stdcall, you won't notice any difference, the function will get called as you wanted, but the assembly code is different. When you call it in your code you'll probably use something like this: code:But if you do anything wrong like: (this code is wrong since the myfunc-function only has 1 parameter.) code:What I wanted to show was that the compiler check for the signature when a callback function is called. When you apply yourself to a hooking-chain or another callback function, you simply leave an address in the memory to the function you want them to call, but they cannot find your calling convention, so Microsoft said: quote:There's a way to bypass the signature check, because you cannot get the signature (well if you know assembly, you could figure it out) after the compilation, but when Windows wants to call your function, it simply uses __stdcall. When you call an API-function with a callback (when you want Windows to call your function), you leave an address to the function position in the memory it's loaded into. It knows which parameters the function must have, because you're using a technique called function-pointers, they defined the signature of the function in Windows code, so when they call it, the signature of your function must be the same as the signature they defined for your function. If the calling convention is wrong, you'll probably get a crash or something, it won't work simply. And JScript isn't compiled code, it's not read by your processor, it's read by an emulator executed by the processor, the JScript-code is getting parsed in real time. The JScript functions aren't stored in memory, and they cannot be because they're not actually compiled code (assembly), so Windows cannot call them without knowing how to call them, and that's quite advanced, the JScript emulator doesn't allow this (this could probably be done with a lot of research and a very hacky result, but the Win32 library isn't written for scripting). Also different parameters in a function-call have different sizes, JScript doesn't because the function doesn't actually exist (this is one of the biggest reasons JScript is easier), it changes the function when it gets called, differently depending on what size of the parameters. Now what Patchou is going to do, is that he creates the callback in his C/C++ code (he needs to know the signature before comiling!), and when his callback gets called he's going to call the JScript emulator, because he's the one with access to it. RE: Developers heart felt wish! by Matti on 02-08-2008 at 05:16 PM Awesome explanation, vikke! Many thanks for clarifying this! RE: Developers heart felt wish! by vikke on 02-08-2008 at 05:58 PM Thanks. I was bored. RE: Developers heart felt wish! by Patchou on 02-08-2008 at 05:59 PM SetWindowLong and SetWindowsHook won't be supported by the new callback system. The restriction is that only synchronous calls made by the callee (like EnumWindows) are allowed. RE: Developers heart felt wish! by vikke on 02-08-2008 at 06:18 PM I was actually hoping for that, but yeah, I understand the restriction, and even if it would be implemented, it would cause a lot of delay to Messenger's windows-messages, since they have to get parsed through JScript before getting handled by the window. RE: Developers heart felt wish! by Patchou on 02-08-2008 at 07:37 PM yep, it would cause lots of delays and I tend to assume that if you want to go that low level, you'll prefer creating a DLL for that. RE: Developers heart felt wish! by felipEx on 03-19-2008 at 07:24 PM
Sorry for 'reviving' this thread, but i wonder if DdeCallback can be done with 4.51 RE: Developers heart felt wish! by matty on 03-19-2008 at 08:54 PM
quote:Asynchronous callbacks are not supported. From our wonderful beta docs quote: RE: Developers heart felt wish! by Patchou on 03-19-2008 at 11:47 PM Yep sorry, no DDE allowed with the new Callback function. |