Cimage img;
img.Attach(hbitmap);


debuggin shows that hbitmap is valid but program fails at Attach line. Thank you if you could help me.