Patrik Stridvall ps@leissner.se writes:
This will give us all the advantages of the "macros"
without any typecasts
that could possibly hide a type error.
What do you say?
I don't like it. I think windowsx.h should not be used at all in Wine; it only obfuscates things by making it harder to see what's really going on.
Obfuscates what? The only thing the "macros" do is that it hides the way the parameters are marshalled. That is totally unintresting for almost all Wine developers. Like the Win16/Win32 thunking code you don't have to know how it works, you just call the appropriate functions. The same with the stdcall calling convention most API functions use. You add WINAPI before the function and you don't care how it works. It is the somebody else problem and you trust that they know what they are doing.
So please explain what the use of FORWARD_* macros obfuscates for I really can't see it. AFAICS it is much better to use the FORWARD_ macros (especially with my hack to make them truely type safe). They are just a function like any other. Why look up how the parameters are marshalled when you can call a function FORWARD_* that not only does it, but does it in a type safe way. If you call the function with the wrong parameters you are very likely to get type errors. If you marshall the parameters in the wrong way it is almost 100% certain that the compiler will say nothing.
Microsoft introduced the windowsx.h macros for a reason and while without inline functions the current implementation of the FORWARD_* macros was the best they could do, it was at least better than nothing since it at least handled the parameter marshalling even if it wasn't 100% type safe.
Another things to think about: What is the difference between calling {Set,Get}WindowText functions and calling the FORWARD_WM_{GET,SET}TEXT macros?
Answer: No difference at all except that you can easily do a PostMessage instead of a SendMessage if you wish.
Of course I'm not suggesting that we should call the FORWARD_WM_{GET,SET}TEXT instead of {Set,Get}WindowText, but in most cases no appropriate functions exists and FORWARD_* macros will at least do the marshalling of parameters and if we implement my version of them also type safe.
Besides, the FORWARD_* macros are not really meant to be used to send messages, they are meant to help receiving messages, so I don't think we should abuse them that way.
No, that is what the HANDLE_* macros are for. The FORWARD_* macros are for sending (or forwarding) messages.
Speaking of which the HANDLE_* macros could find uses in COMCTL32 and other similar DLL:s to provide a type safe receiving of messages. I don't even think we will have to do as a proposed for the FORWARD_* to make them truely type safe.