Hungary and Croatia were separate kingdoms which happened to be ruled by the same person, the Habsburg emperor. This is called a personal union - the realms were not institutionally united, but only united in the person of the monarch. Queen Elizabeth II is also the Queen of Canada, Australia, and New Zealand, but they are separate countries with separate governments.