问题
I was having a look at the documentation for BM_GETCHECK and it seems that this functionality is only supported on Windows Vista and above. That is, this is not a supported message in Windows XP. A quick search online doesn't immediately yield an alternative way of getting the control state.
Several other messages (this for example) that I would also expect to work on Windows XP are reported to not be supported. Does anyone have any insight into this? How does one generally handle Windows XP compatibility?
Unfortunately we still have a notably Windows XP client base so Windows XP support is still necessary.
回答1:
Unfortunately MSDN has become a tool for Microsoft's war on pre-Vista OS versions, and it now lies (or at least misleads) about the minimum supported OS version.
That is, since Vista is now the earliest supported OS, none of the APIs (or at least the ones who have had their documentation updated) are "supported" on an earlier version, even though they may actually exist and work just fine.
BM_GETCHECK
did exist on Windows XP, in fact it existed on Windows 2000 and probably Windows 95 as well. Code that works on XP doesn't magically stop working simply because Microsoft no longer support XP.
Unfortunately your only way to be sure about the status of an API function or message is to use an old version of the MSDN library (one that pre-dates Windows 7 which is I believe around the time they started updating the minimum version numbers).
来源:https://stackoverflow.com/questions/31974213/windows-xp-winapi-support-for-checkbox-controls