Assign to "intptr_t", which on some versions of MS-Windows will widen the variable; then cast to HANDLE.