Okay, I have narrowed it down to one line of code that is causing the failure.

Quote:
scan_view.bmap = scan_bmp;


Everything else works if I remove this one line. But this is the line that makes the map work.