Prevent the use of windowsx.h with Wine source.

Martin Fuchs martin-fuchs at gmx.net
Sun Mar 19 14:54:56 CST 2006


2006/3/19, Alexandre Julliard <julliard at winehq.org>:
> I think these windowsx macros are confusing things more than helping,
> especially since they don't look like macros. It's better to have
> explicit SendMessage calls than some pseudo function calls, it makes
> much more obvious what's going on, especially for people who try to
> debug the code without being very familiar with the Windows API. The
> fact that getting rid of the macros also avoids the warnings is just
> icing on the cake.

Just one random example out of the committed Winefile patch:

- int idx = ListBox_AddString(hlbox, infoStr);
- ListBox_SetItemData(hlbox, idx, pTxt);
+ int idx = SendMessage(hlbox, LB_ADDSTRING, 0L, (LPARAM)infoStr);
+ SendMessage(hlbox, LB_SETITEMDATA, idx, (LPARAM) pTxt);

You can't tell us those SendMessage calls are cleaner and more easy to
understand. They contain those ugly (LPARAM) type casts, unused "0L"
wparam parameters and result in longer, less readable code.

Regards,

    Martin



More information about the wine-devel mailing list