When unsubclassing tools, use toolPtr->hwnd instead of toolPtr->uId if toolPtr->flags does not contain TTF_IDISHWND (meaning uId is not a valid window handle).