Teach him that when he pays attention to you and not the treat, he gets the treat! Hold a treat out in your hand away from your body. He'll probably start out by staring at the treat in your hand... Let him stare. Eventually he should glance over at your face (which could take a while, be patient!) the second he does, click (or do whatever you're doing to mark the behavior) and give him the treat.... Repeat. He should figure out that he gets the treat when he looks at YOU. Slowly increase the amount of time he has to look at you... from a brief glance increase it to a second or two, then 5 seconds, then 10.. Eventually he'll just sit and stare you in the face, paying attention to what you're doing instead of where the treat is.
My boy would sit there and stare and whine at my hand or a toy or whatever.. After working with him a few times like this, he now looks me right in the eyes when he wants something. He knows that I'm the one that's going to get it for him, so he pays attention to ME.
Here's a good article that gives more details on attention:
http://www.clickersolutions.com/arti.../attention.htm