Ive found the 'createimage' uses a lot of processor power for what it does, I'd try creating the image before you enter your programs main loop and passing that image handle to your function instead of creating the image inside the function.
I know your using the 'createimagebb' so I dont know if this info is valid.
Mr Brine
I know your using the 'createimagebb' so I dont know if this info is valid.
Mr Brine