When Philip IV of Spain died in 1665, the great powers wondered how long his heir, the sickly Charles II, would last. Wilhelm was put to work by France to begin negotiations related to the succession in Spain and in the Spanish Netherlands. In the run up to the War of Devolution, Wilhelm carried funds to Maximilian to fund the build-up of an army for Cologne. He also visited the Count Palatine of Neuburg, Philip Wilhelm, and the Elector of Bavaria to persuade them not to allow Austrian forces to move through their lands to oppose French maneuvers in the Netherlands. On 8 January 1667, Wilhelm went to Vienna representing Cologne (but acting on behalf of France) to sound out the Emperor's feelings about the succession, perhaps splitting the Netherlands from Spain after the death of Charles. There he spent much time establishing relationships with various ministers at the court. He was offered titles and money to join the Habsburg side and work for the end of the League of the Rhine, but he demurred. He was also sought by Petar Zrinski, who wished his help (and thus French help) in a Hungarian revolution. Wilhelm avoided being seen too often with him. However, he did let Louis XIV know of the Hungarian revolutionaries, and their potential to provide an opportune diversion for Austrian forces. This laid the ground for a 1668 treaty between France and Austria agreeing that if Charles died without an heir, France would receive the Spanish Netherlands, the County of Burgundy, Navarre, the Philippines, the Two Sicilies, and Morocco, while the remaining Spanish territories would go to Austria.