King William IV (1765-1837) when Duke of Clarence