the rabbis count 48 prophets and 7 prophetesses in tenach [added credit to DoubleAA- whose prophecies are relevant for future generations]. It seems Adam and Abel and Cain aren't listed
http://www.askmoses.com/en/article/248,89728/How-many-prophets-were-there-and-who-were-they.html
The RAMBAM lists levels of prophecy. (in his guide for the purplexed). Moses had the highest level. And below that is a vision or dream.
I recommend rabbi aryeh kaplan's handbook of jewish thought vol 1, it might mention a bit about prophecy. There were even schools of prophecy apparently.
Somebody that God speaks to in a vision or dream, is a prophet. A "Navi".
Bilam's level of prophecy might've been the same as Moses. Bilam was bad but God gave him those abilities anyway.
http://curiousjew.blogspot.co.uk/2007/12/balaam-and-moses-prophets-of-god.html "In one of the most famous comparisons in Midrash, the heathen prophet Balaam and the Jewish prophet Moses are equated. It is said that their powers are equal"
A level below a vision or dream type prophecy, is Ruach Hakodesh. I'm not sure whether one would call that a low level prophecy or not prophecy at all, but it involves God putting an idea or thought or solution in somebody's mind. I heard somewhere that of the Tenach(Torah Neviim and Ketuvim), Neviim involves vision/dreams, that's for a Navi, a prophet. The contents of Ketuvim(the book of writings) was written with Ruach HaKodesh.
I have heard that at Gan Eden(the garden of eden), God revealed himself at a high level of prophecy. That is mentioned here for example http://www.torah.org/learning/rabbis-notebook/5760/kisisa.html
"At the giving of the Torah, G-d once again decided to manifest Himself to the Bnai Yisroel on a level that was similar to Gan Eden"
So maybe the 48 prophets and 7 prophetesses isn't including God communicating at the time of Gan Eden because prophecy then was not so unusual. The rules were different at that time.
As for why God could talk to a bad person,a reason could be that their lives may interact with the lives of good people. Bilam ended up blessing the Jewish people. Or it may be to test;.. One could always come up with reasons, for specific cases. And there might not be one or some general rules that we can rationally determine.