In general whole spices are fried, either in oil, often with the onions, for a curry etc. Though you can also dry fry whole spices to get them really fragrant and toasty before grinding for a homemade garam masala for instance.
Already ground spices are added later in the cooking because they are so much more delicate. They dont have their casing to protect them from the heat.
If you are serving yogurt with a curry, or Mediterranean meal, try dry frying cumin seeds and grinding them, before sprinkling over the yogurt. Its amazing.
On the subject of dry frying, have you ever tried doing rice? Once they dart to colour a golden brown, grind them straight away and they will be so tasty sprinkled on lots of middle eastern, indian and far eastern salads.