uint32_t id = (uint32_t)(uintptr_t)hwnd;

で問題ないよ