Tidying of code, porting of HBITMAP handling