GetDIBits should help you.