Sometimes I see names abbreviated sometimes as A. B. Lastname and some other times A.-B. Lastname. Is there a difference? Does the former means it is a middle name, and the latter means it is a part of first name?
A.-B. Lastname indicates a hyphenated first name. For example, Anne-Marie Slaughter might be referred to as A.-M. Slaughter.
A. B. Lastname is giving the initials of the first name and middle name.
I feel that @JohnBartholomew's answer is incomplete - it doesn't cover two-part unhyphenated first names. For example, it's possible that "A. M. Slaughter", short for "Anne Marie Slaughter", could be used EITHER when the first name is "Anne Marie" (and there's no middle name) OR when the first name is "Anne" and the middle name is "Marie".
Where I come from, two-part unhyphenated first names are relatively common. The two most famous examples that spring to mind are the politician Te Ururoa Flavell and the actor Te Kohe Tuhaka. But it's not just Māori names that this happens with - I once knew a woman whose first name was "Emma Louise", and who had no middle name.
So, to answer the question, "A. B. Lastname" could EITHER be the initials of the first name and middle name, OR the initials of two parts of the first name.