You don't say anything about what OS you are on.
If you were a glutton for punishment,
and on win32, you could interface with the existing
twain libraries. If you are on linux/un*x,
several libraries and applications exist
(UPDATE: such as SANE).
I'd check http://freshmeat.net and not be
afraid to bring in a little outside help for the
heavy-lifting.