It works in Win 98 but not in Win NT

Hi
I have code that displays a portion  of a bitmap on a form's canvas, when
you scroll down with a scroll bar on the from you can scroll the BMP , in
Win 98 it works with out a problem, but in Win NT it sometimes works but
sometimes it doesn't want to create the new BMP that you scrolled.

The Code make use of the win32 API calls "CreateDIBitmap" and "DeleteObject"
for creating the BMP and then copy the BMP onto the form's canvas then
freeing the recources with "DeleteObject".

What could be the problem, it looks like it is OS related, but how can I
rectify the problem?