Can you look in task manager how many GDI handles your process is using when this error occurs. There is a hard limit of 10k