Prevent the use of windowsx.h with Wine source.

Alexandre Julliard julliard at winehq.org
Mon Mar 20 03:56:57 CST 2006


"Martin Fuchs" <martin-fuchs at gmx.net> writes:

> 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.

Not necessarily; the code makes it obvious that we are sending a
message here, not calling a function (or worse, a macro disguised as a
function). In many cases that's important information, for instance
when you try to match a message trace with the code. The casts are
ugly but they are present in the macro too, so it isn't any more
typesafe, it just looks like it is.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list