It is hard. The thought that helps me the most usually is that I know I'm actually going to feel worse either directly after I eat, later the same day, or the next day. And I'll continue to feel worse/crappy about it for days and weeks as I stay overweight, while that ice cream, cheeseburger, whatever, is long long gone.
Also if I find myself right on the verge of just saying 'screw it' and hopping in the car to go to the drive thru, I make myself look up the calories online first. It's horrifying to see that the strawberry frosty you were thinking about getting is going to be 1200 calories.
It also helps when you succeed a few times and have the memory of being so relieved that night, "thank god I didn't eat that giant slice of cake; I'd be feeling so crappy right now, and instead I feel pretty good for resisting."
Still, it's always hard at the time. But I usually cycle through the above and just try to get through it for a few more hours and the craving usually passes.
Random edit - also I've taken to eating this lemon/herb/garlic/salt topping I got from Trader Joe's in a grinder. It's got some sea salt in it but is mostly dried garlic/onion/lemon peel/peppercorns in a grinder. I just grind out half a teaspoon or so of it and slowly eat it. Very flavorful (almost overpowering), spicy due to the peppercorn, and usually makes me stop desperately needing to eat something because it's distracting - and 0 calories. (probably more like 5, but not enough to worry about). This seems weird to me and it kind of freaked me out when I found myself craving it, but I finally decided what's really the harm compared to what all else I could eat.