How to check whether the specified WMID exists

In order to check whether the given WMID exists in the system, you need to use Interface X8.