If you don't have to use Twain, the easiest and painfree way is to use WIA. There is a good tutorial here. Also have a look at the coding4fun site because I am sure someone has an implementation that does what you are attempting.