Detecting the eyes in an image produced by a regular web-cam, and reliably determining whether they are open or closed is very difficult.
If you have about $30,000 to spare, you can buy yourself an eye tracker, which would allow you to control your computer with your eyes, and, as a byproduct, would also detect when you blink.
If you are on a tight budget, then you can try to make your own. Eye trackers typically consist of an infra-red light source and an IR camera. The pupils of your eyes reflect IR very well, and the camera is used to detect the reflections. You can try to put something like that together yourself, if you can find an IR camera with a sufficiently fast frame rate. Since you only need to detect the presence or absence of the pupils in the camera image, rather than the direction of gaze, writing the software to do that is not terribly hard.
Alternatively, by placing electrodes on your head you can detect electrical signals that correspond to your eye-movements. In fact, this is a way to build a very cheap eye tracker for controlling your computer by moving your eyes. I am guessing, that you may be able to use a setup like that to detect blinks as well. Of course, that would mean being tied to the computer with wires. But if you spend so much time at the computer that you forget to blink, that should not be a problem. :)